123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- upstream myapp {
- ip_hash;
- server 127.0.0.1:48080;
- }
- server {
- listen 80;
- server_name ai.manage.daoguyujia.com manage.daogu.ai;
- client_max_body_size 500M;
- location / {
- proxy_pass http://127.0.0.1:8088;
- proxy_http_version 1.1;
- proxy_connect_timeout 4s;
- proxy_read_timeout 120s;
- proxy_send_timeout 120s;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "upgrade";
- 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;
- }
- # 强制跳转到 HTTPS
- return 301 https://$host$request_uri;
- }
- server {
- listen 8088;
- client_max_body_size 500M;
- location / {
- index index.html;
- root /home/BackendFront/dist;
- # Vue 路由设置
- try_files $uri $uri/ /index.html;
- # 允许跨域
- add_header Access-Control-Allow-Headers *;
- add_header Access-Control-Allow-Origin $http_origin always;
- add_header Access-Control-Allow-Methods 'GET,POST,OPTIONS';
- add_header Access-Control-Allow-Credentials 'true';
- }
- # 接口代理配置 (Vue项目代理)
- location /api/ {
- proxy_pass http://myapp/api/;
- 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;
- }
- # 接口开放监听 (SSE)
- location /api/sse/ {
- proxy_pass http://myapp/api/sse/;
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_read_timeout 300s;
- proxy_send_timeout 300s;
- proxy_buffering off;
- proxy_cache off;
- proxy_set_header Connection "";
- }
- }
- server {
- listen 443 ssl;
- server_name ai.manage.daoguyujia.com manage.daogu.ai;
- client_max_body_size 500M;
- ssl_certificate /root/.acme.sh/ai.manage.daoguyujia.com/fullchain.cer;
- ssl_certificate_key /root/.acme.sh/ai.manage.daoguyujia.com/ai.manage.daoguyujia.com.key;
- ssl_session_cache shared:SSL:1m;
- ssl_session_timeout 5m;
- ssl_ciphers HIGH:!aNULL:!MD5;
- ssl_prefer_server_ciphers on;
- location / {
- index index.html;
- root /home/BackendFront/dist;
- # Vue 路由设置
- try_files $uri $uri/ /index.html;
- # 允许跨域
- add_header Access-Control-Allow-Headers *;
- add_header Access-Control-Allow-Origin $http_origin always;
- add_header Access-Control-Allow-Methods 'GET,POST,OPTIONS';
- add_header Access-Control-Allow-Credentials 'true';
- }
- # 接口代理配置 (Vue项目代理)
- location /api/ {
- proxy_pass http://myapp/api/;
- 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;
- }
- # 接口开放监听 (SSE)
- location /api/sse/ {
- proxy_pass http://myapp/api/sse/;
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_read_timeout 300s;
- proxy_send_timeout 300s;
- proxy_buffering off;
- proxy_cache off;
- proxy_set_header Connection "";
- }
- }
|