xsh_1997 hace 1 mes
padre
commit
c001f1a3e5
Se han modificado 1 ficheros con 250 adiciones y 0 borrados
  1. 250 0
      doc/nginx.conf

+ 250 - 0
doc/nginx.conf

@@ -0,0 +1,250 @@
1
+worker_processes auto;
2
+worker_cpu_affinity auto; 
3
+worker_rlimit_nofile 65535;
4
+
5
+events {
6
+    worker_connections 8192;
7
+	use epoll; 
8
+	multi_accept on;
9
+	accept_mutex off;  
10
+}
11
+
12
+http {
13
+    include       mime.types;
14
+    default_type  application/octet-stream;
15
+    sendfile        on;
16
+	tcp_nopush      on;
17
+	tcp_nodelay     on;
18
+    keepalive_timeout  65;
19
+	client_max_body_size 60m;
20
+	proxy_connect_timeout 15s;
21
+    proxy_read_timeout 120s;
22
+
23
+	gzip on;
24
+	gzip_min_length 1k;
25
+	gzip_comp_level 9;
26
+	gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
27
+	gzip_vary on;
28
+	gzip_disable "MSIE [1-6]\.";
29
+	
30
+	server {
31
+		listen 443 ssl http2;  
32
+		server_name bqxm.alafarms.com;
33
+	 
34
+		root html;
35
+		index index.html index.htm;
36
+		ssl_certificate /usr/local/nginx/jks/bqxm.alafarms.com.pem;
37
+		ssl_certificate_key /usr/local/nginx/jks/bqxm.alafarms.com.key;
38
+		ssl_session_timeout 5m;
39
+		ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
40
+		ssl_prefer_server_ciphers on;
41
+
42
+        # ====================== SPA 静态资源规则 ======================
43
+        # 部署目录:/opt/page/bqH5/、/opt/page/bqjy/ ...
44
+        # 1. /xxx/assets/ 优先匹配,找不到就 404,禁止 fallback 成 index.html
45
+        # 2. index.html 禁止缓存(防 iOS 微信缓存旧入口)
46
+        # 3. 其它 .js/.css 等静态文件同样 404,不回 HTML
47
+        # 4. 仅前端路由才 fallback 到 index.html
48
+        # ======================================================
49
+		
50
+		# 页面1 bqH5(uni-app 移动端 H5)
51
+		location ^~ /bqH5/assets/ {
52
+			root /opt/page;
53
+			try_files $uri =404;
54
+			expires 1y;
55
+			add_header Cache-Control "public, immutable";
56
+			access_log off;
57
+		}
58
+		location = /bqH5/index.html {
59
+			root /opt/page;
60
+			add_header Cache-Control "no-cache, no-store, must-revalidate";
61
+			add_header Pragma "no-cache";
62
+			add_header Expires "0";
63
+		}
64
+		location ~* ^/bqH5/.+\.(js|mjs|css|png|jpg|jpeg|svg|ico|woff|woff2|ttf|map)$ {
65
+			root /opt/page;
66
+			try_files $uri =404;
67
+			expires 7d;
68
+			add_header Cache-Control "public, max-age=604800";
69
+		}
70
+		location /bqH5/ {
71
+			root /opt/page;
72
+			index index.html index.htm;
73
+			try_files $uri $uri/ /bqH5/index.html;
74
+			add_header Cache-Control "no-cache, no-store, must-revalidate";
75
+		}
76
+		
77
+		# 页面2 bqjy
78
+		location ^~ /bqjy/assets/ {
79
+			root /opt/page;
80
+			try_files $uri =404;
81
+			expires 1y;
82
+			add_header Cache-Control "public, immutable";
83
+			access_log off;
84
+		}
85
+		location = /bqjy/index.html {
86
+			root /opt/page;
87
+			add_header Cache-Control "no-cache, no-store, must-revalidate";
88
+			add_header Pragma "no-cache";
89
+			add_header Expires "0";
90
+		}
91
+		location ~* ^/bqjy/.+\.(js|mjs|css|png|jpg|jpeg|svg|ico|woff|woff2|ttf|map)$ {
92
+			root /opt/page;
93
+			try_files $uri =404;
94
+			expires 7d;
95
+			add_header Cache-Control "public, max-age=604800";
96
+		}
97
+		location /bqjy/ {
98
+			root /opt/page;
99
+			index index.html index.htm;
100
+			try_files $uri $uri/ /bqjy/index.html;
101
+			add_header Cache-Control "no-cache, no-store, must-revalidate";
102
+		}
103
+		
104
+		# 页面3 client
105
+		location ^~ /client/assets/ {
106
+			root /opt/page;
107
+			try_files $uri =404;
108
+			expires 1y;
109
+			add_header Cache-Control "public, immutable";
110
+			access_log off;
111
+		}
112
+		location = /client/index.html {
113
+			root /opt/page;
114
+			add_header Cache-Control "no-cache, no-store, must-revalidate";
115
+			add_header Pragma "no-cache";
116
+			add_header Expires "0";
117
+		}
118
+		location ~* ^/client/.+\.(js|mjs|css|png|jpg|jpeg|svg|ico|woff|woff2|ttf|map)$ {
119
+			root /opt/page;
120
+			try_files $uri =404;
121
+			expires 7d;
122
+			add_header Cache-Control "public, max-age=604800";
123
+		}
124
+		location /client/ {
125
+			root /opt/page;
126
+			index index.html index.htm;
127
+			try_files $uri $uri/ /client/index.html;
128
+			add_header Cache-Control "no-cache, no-store, must-revalidate";
129
+		}
130
+		
131
+		# 页面4 screen
132
+		location ^~ /screen/assets/ {
133
+			root /opt/page;
134
+			try_files $uri =404;
135
+			expires 1y;
136
+			add_header Cache-Control "public, immutable";
137
+			access_log off;
138
+		}
139
+		location = /screen/index.html {
140
+			root /opt/page;
141
+			add_header Cache-Control "no-cache, no-store, must-revalidate";
142
+			add_header Pragma "no-cache";
143
+			add_header Expires "0";
144
+		}
145
+		location ~* ^/screen/.+\.(js|mjs|css|png|jpg|jpeg|svg|ico|woff|woff2|ttf|map)$ {
146
+			root /opt/page;
147
+			try_files $uri =404;
148
+			expires 7d;
149
+			add_header Cache-Control "public, max-age=604800";
150
+		}
151
+		location /screen/ {
152
+			root /opt/page;
153
+			index index.html index.htm;
154
+			try_files $uri $uri/ /screen/index.html;
155
+			add_header Cache-Control "no-cache, no-store, must-revalidate";
156
+		}
157
+		
158
+		# 页面5 shopClient
159
+		location ^~ /shopClient/assets/ {
160
+			root /opt/page;
161
+			try_files $uri =404;
162
+			expires 1y;
163
+			add_header Cache-Control "public, immutable";
164
+			access_log off;
165
+		}
166
+		location = /shopClient/index.html {
167
+			root /opt/page;
168
+			add_header Cache-Control "no-cache, no-store, must-revalidate";
169
+			add_header Pragma "no-cache";
170
+			add_header Expires "0";
171
+		}
172
+		location ~* ^/shopClient/.+\.(js|mjs|css|png|jpg|jpeg|svg|ico|woff|woff2|ttf|map)$ {
173
+			root /opt/page;
174
+			try_files $uri =404;
175
+			expires 7d;
176
+			add_header Cache-Control "public, max-age=604800";
177
+		}
178
+		location /shopClient/ {
179
+			root /opt/page;
180
+			index index.html index.htm;
181
+			try_files $uri $uri/ /shopClient/index.html;
182
+			add_header Cache-Control "no-cache, no-store, must-revalidate";
183
+		}
184
+		
185
+		# 页面6 bqShop
186
+		location ^~ /bqShop/assets/ {
187
+			root /opt/page;
188
+			try_files $uri =404;
189
+			expires 1y;
190
+			add_header Cache-Control "public, immutable";
191
+			access_log off;
192
+		}
193
+		location = /bqShop/index.html {
194
+			root /opt/page;
195
+			add_header Cache-Control "no-cache, no-store, must-revalidate";
196
+			add_header Pragma "no-cache";
197
+			add_header Expires "0";
198
+		}
199
+		location ~* ^/bqShop/.+\.(js|mjs|css|png|jpg|jpeg|svg|ico|woff|woff2|ttf|map)$ {
200
+			root /opt/page;
201
+			try_files $uri =404;
202
+			expires 7d;
203
+			add_header Cache-Control "public, max-age=604800";
204
+		}
205
+		location /bqShop/ {
206
+			root /opt/page;
207
+			index index.html index.htm;
208
+			try_files $uri $uri/ /bqShop/index.html;
209
+			add_header Cache-Control "no-cache, no-store, must-revalidate";
210
+		}
211
+		
212
+		# 上传图片
213
+		location /profile/ {
214
+			alias  /home/baqing/uploadPath/;
215
+			expires 30d;
216
+		}
217
+		
218
+		# 后端接口
219
+		location /prod-api/ {
220
+			proxy_set_header Host $http_host;
221
+			proxy_set_header X-Real-IP $remote_addr;
222
+			proxy_set_header REMOTE-HOST $remote_addr;
223
+			proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
224
+			proxy_pass http://localhost:8010/;
225
+		}
226
+		
227
+		location /shop-api/ {
228
+			proxy_set_header Host $http_host;
229
+			proxy_set_header X-Real-IP $remote_addr;
230
+			proxy_set_header REMOTE-HOST $remote_addr;
231
+			proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
232
+			proxy_pass http://localhost:8020/;
233
+		}
234
+		
235
+		# gis
236
+		location /agis-api/ {
237
+			proxy_set_header Host $http_host;
238
+			proxy_set_header X-Real-IP $remote_addr;
239
+			proxy_set_header REMOTE-HOST $remote_addr;
240
+			proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
241
+			proxy_pass http://192.168.136.240:7103/;
242
+		}
243
+		
244
+		error_page   500 502 503 504  /50x.html;
245
+		location = /50x.html {
246
+				root   html;
247
+		}
248
+		
249
+   }
250
+}