|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+user root;
|
|
|
2
|
+worker_processes auto;
|
|
|
3
|
+pid /run/nginx.pid;
|
|
|
4
|
+include /etc/nginx/modules-enabled/*.conf;
|
|
|
5
|
+
|
|
|
6
|
+events {
|
|
|
7
|
+ worker_connections 768;
|
|
|
8
|
+ # multi_accept on;
|
|
|
9
|
+}
|
|
|
10
|
+
|
|
|
11
|
+http {
|
|
|
12
|
+
|
|
|
13
|
+ ##
|
|
|
14
|
+ # Basic Settings
|
|
|
15
|
+ ##
|
|
|
16
|
+
|
|
|
17
|
+ sendfile on;
|
|
|
18
|
+ tcp_nopush on;
|
|
|
19
|
+ tcp_nodelay on;
|
|
|
20
|
+ keepalive_timeout 65;
|
|
|
21
|
+ types_hash_max_size 2048;
|
|
|
22
|
+ # server_tokens off;
|
|
|
23
|
+
|
|
|
24
|
+ # server_names_hash_bucket_size 64;
|
|
|
25
|
+ # server_name_in_redirect off;
|
|
|
26
|
+
|
|
|
27
|
+ include /etc/nginx/mime.types;
|
|
|
28
|
+ default_type application/octet-stream;
|
|
|
29
|
+
|
|
|
30
|
+ ##
|
|
|
31
|
+ # SSL Settings
|
|
|
32
|
+ ##
|
|
|
33
|
+
|
|
|
34
|
+ ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
|
|
|
35
|
+ ssl_prefer_server_ciphers on;
|
|
|
36
|
+
|
|
|
37
|
+ ##
|
|
|
38
|
+ # Logging Settings
|
|
|
39
|
+ ##
|
|
|
40
|
+
|
|
|
41
|
+ access_log /var/log/nginx/access.log;
|
|
|
42
|
+ error_log /var/log/nginx/error.log;
|
|
|
43
|
+
|
|
|
44
|
+ ##
|
|
|
45
|
+ # Gzip Settings
|
|
|
46
|
+ ##
|
|
|
47
|
+
|
|
|
48
|
+ gzip on;
|
|
|
49
|
+ # 大屏应用配置
|
|
|
50
|
+server {
|
|
|
51
|
+ listen 9998;
|
|
|
52
|
+ server_name 47.93.202.126;
|
|
|
53
|
+
|
|
|
54
|
+ # location = /bigScreen {
|
|
|
55
|
+ # return 302 $scheme://$http_host/bigScreen/;
|
|
|
56
|
+ # }
|
|
|
57
|
+
|
|
|
58
|
+ location /bigScreen/ {
|
|
|
59
|
+ alias /home/website/zlzh/bigScreen/dist/;
|
|
|
60
|
+ try_files $uri $uri/ /index.html;
|
|
|
61
|
+
|
|
|
62
|
+ # 静态文件缓存
|
|
|
63
|
+ location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
|
|
64
|
+ expires 1y;
|
|
|
65
|
+ add_header Cache-Control "public, immutable";
|
|
|
66
|
+ }
|
|
|
67
|
+ }
|
|
|
68
|
+
|
|
|
69
|
+ # API代理配置
|
|
|
70
|
+ location /api {
|
|
|
71
|
+ # 这里需要替换为你的实际API服务器地址
|
|
|
72
|
+ proxy_pass http://127.0.0.1:8080; # 请修改为你的API服务器地址
|
|
|
73
|
+ proxy_set_header Host $host;
|
|
|
74
|
+ proxy_set_header X-Real-IP $remote_addr;
|
|
|
75
|
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
76
|
+ proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
77
|
+
|
|
|
78
|
+ # 代理超时设置
|
|
|
79
|
+ proxy_connect_timeout 60s;
|
|
|
80
|
+ proxy_send_timeout 60s;
|
|
|
81
|
+ proxy_read_timeout 60s;
|
|
|
82
|
+
|
|
|
83
|
+ # WebSocket支持(如果需要)
|
|
|
84
|
+ proxy_http_version 1.1;
|
|
|
85
|
+ proxy_set_header Upgrade $http_upgrade;
|
|
|
86
|
+ proxy_set_header Connection "upgrade";
|
|
|
87
|
+ }
|
|
|
88
|
+
|
|
|
89
|
+ # Web应用配置(根目录)
|
|
|
90
|
+ location / {
|
|
|
91
|
+ root /home/website/zlzh/web/dist;
|
|
|
92
|
+ try_files $uri $uri/ /index.html;
|
|
|
93
|
+
|
|
|
94
|
+ # 静态文件缓存
|
|
|
95
|
+ location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
|
|
96
|
+ expires 1y;
|
|
|
97
|
+ add_header Cache-Control "public, immutable";
|
|
|
98
|
+ }
|
|
|
99
|
+ }
|
|
|
100
|
+}
|
|
|
101
|
+
|
|
|
102
|
+# Web应用和API配置
|
|
|
103
|
+server {
|
|
|
104
|
+ listen 10000;
|
|
|
105
|
+ server_name zhyh.hnyulin.com;
|
|
|
106
|
+
|
|
|
107
|
+ # API代理配置
|
|
|
108
|
+ location /api {
|
|
|
109
|
+ # 这里需要替换为你的实际API服务器地址
|
|
|
110
|
+ proxy_pass http://127.0.0.1:8080; # 请修改为你的API服务器地址
|
|
|
111
|
+ proxy_set_header Host $host;
|
|
|
112
|
+ proxy_set_header X-Real-IP $remote_addr;
|
|
|
113
|
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
114
|
+ proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
115
|
+
|
|
|
116
|
+ # 代理超时设置
|
|
|
117
|
+ proxy_connect_timeout 60s;
|
|
|
118
|
+ proxy_send_timeout 60s;
|
|
|
119
|
+ proxy_read_timeout 60s;
|
|
|
120
|
+
|
|
|
121
|
+ # WebSocket支持(如果需要)
|
|
|
122
|
+ proxy_http_version 1.1;
|
|
|
123
|
+ proxy_set_header Upgrade $http_upgrade;
|
|
|
124
|
+ proxy_set_header Connection "upgrade";
|
|
|
125
|
+ }
|
|
|
126
|
+
|
|
|
127
|
+ # Web应用配置(根目录)
|
|
|
128
|
+ location / {
|
|
|
129
|
+ root /home/website/zlzh/web;
|
|
|
130
|
+ try_files $uri $uri/ /index.html;
|
|
|
131
|
+
|
|
|
132
|
+ # 静态文件缓存
|
|
|
133
|
+ location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
|
|
134
|
+ expires 1y;
|
|
|
135
|
+ add_header Cache-Control "public, immutable";
|
|
|
136
|
+ }
|
|
|
137
|
+ }
|
|
|
138
|
+
|
|
|
139
|
+ # 通用配置
|
|
|
140
|
+ # access_log /var/log/nginx/zhyh_access.log main;
|
|
|
141
|
+ # error_log /var/log/nginx/zhyh_error.log notice;
|
|
|
142
|
+
|
|
|
143
|
+ # 客户端限制
|
|
|
144
|
+ client_max_body_size 100M;
|
|
|
145
|
+
|
|
|
146
|
+ # 禁止访问隐藏文件
|
|
|
147
|
+ location ~ /\. {
|
|
|
148
|
+ deny all;
|
|
|
149
|
+ }
|
|
|
150
|
+}
|
|
|
151
|
+
|
|
|
152
|
+
|
|
|
153
|
+ include /etc/nginx/conf.d/*.conf;
|
|
|
154
|
+ include /etc/nginx/sites-enabled/*;
|
|
|
155
|
+}
|
|
|
156
|
+
|