1234567891011121314151617181920212223242526272829303132333435 |
- server {
- listen 80;
- server_name localhost;
- gzip on;
- gzip_static on; # 需要http_gzip_static_module 模块
- gzip_min_length 1k;
- gzip_comp_level 4;
- gzip_proxied any;
- gzip_types text/plain text/xml text/css text/event-stream; # 添加 text/event-stream;
- gzip_vary on;
- gzip_disable "MSIE [1-6]\.(?!.*SV1)";
- # 前端打包好的dist目录文件
- root /data/;
- location ^~/api/ {
- proxy_pass http://lttcai-gateway:9999/; #注意/后缀
- proxy_connect_timeout 60s;
- proxy_read_timeout 120s;
- proxy_send_timeout 120s;
- 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 http;
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "upgrade";
- proxy_set_header Host $http_host;
- proxy_set_header from "";
- # 为服务端推送事件(SSE)禁用缓冲
- proxy_buffering off;
- proxy_cache off;
- }
- }
|