| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- # 地磅移动端 H5 - dbapp.shanxiachem.com(仅 HTTP,暂无证书)
- # 部署路径:/etc/nginx/conf.d/dbapp.shanxiachem.com.conf
- #
- # 静态根:/iflytek/shanxia2.0/dbapp
- # 访问地址:http://dbapp.shanxiachem.com
- # API:与 web 端相同 → 127.0.0.1:9111
- # 附件(MinIO bucket=ruoyi):/ruoyi/ → 127.0.0.1:9000
- #
- # 证书就绪后可再增加 listen 443 ssl 的 server 块。
- server {
- listen 80;
- server_name dbapp.shanxiachem.com;
- root /iflytek/shanxia2.0/dbapp;
- index index.html index.htm;
- client_max_body_size 50M;
- # access_log /iflytek/soft/nginx/nginx120/logs/dbapp-access.log main;
- # error_log /iflytek/soft/nginx/nginx120/logs/dbapp-error.log warn;
- gzip on;
- gzip_vary on;
- gzip_min_length 1024;
- gzip_comp_level 6;
- gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml application/json application/x-font-ttf font/opentype image/svg+xml;
- add_header X-Frame-Options "SAMEORIGIN" always;
- add_header X-Content-Type-Options "nosniff" always;
- add_header X-XSS-Protection "1; mode=block" always;
- # 与 web 端同一后端
- location ^~ /api/ {
- proxy_pass http://127.0.0.1:9111;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto $scheme;
- proxy_set_header X-Forwarded-Port $server_port;
- proxy_set_header Authorization $http_authorization;
- proxy_pass_header Authorization;
- proxy_connect_timeout 60s;
- proxy_send_timeout 60s;
- proxy_read_timeout 60s;
- add_header Access-Control-Allow-Origin * always;
- add_header Access-Control-Allow-Methods 'GET, POST, PUT, DELETE, OPTIONS, PATCH' always;
- add_header Access-Control-Allow-Headers 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization' always;
- if ($request_method = 'OPTIONS') {
- return 204;
- }
- }
- # MinIO(bucket=ruoyi)
- location ^~ /ruoyi/ {
- proxy_pass http://127.0.0.1:9000;
- proxy_set_header Host $http_host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto $scheme;
- proxy_connect_timeout 60s;
- proxy_send_timeout 60s;
- proxy_read_timeout 60s;
- add_header Access-Control-Allow-Origin * always;
- add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS' always;
- if ($request_method = 'OPTIONS') {
- return 204;
- }
- }
- location = /health {
- proxy_pass http://127.0.0.1:9111/health;
- proxy_set_header Host $host;
- access_log off;
- }
- location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2|ttf|eot)$ {
- expires 1y;
- add_header Cache-Control "public, immutable";
- try_files $uri =404;
- add_header Access-Control-Allow-Origin *;
- }
- location = /index.html {
- expires -1;
- add_header Cache-Control "no-store, no-cache, must-revalidate";
- }
- # Hash 路由 SPA
- location / {
- try_files $uri $uri/ /index.html;
- }
- location /health-web {
- access_log off;
- default_type text/plain;
- return 200 "dbapp h5 healthy\n";
- }
- location ~ /\. {
- deny all;
- access_log off;
- log_not_found off;
- }
- error_page 404 /index.html;
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root /iflytek/soft/nginx/nginx120/html;
- internal;
- }
- }
|