西藏巴青项目

nginx.conf 7.0KB

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