server { listen 80; server_name localhost; client_max_body_size 1024m; # 是否启动 gzip 压缩 gzip on; # 需要压缩的常见静态资源 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; # 如果文件大于 1k 就启动压缩 gzip_min_length 1k; # 缓冲区 gzip_buffers 4 16k; # 压缩的等级 gzip_comp_level 2; # access_log /var/log/nginx/host.access.log main; location / { root /usr/share/nginx/html; index index.html index.htm; 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; # web history 模式 404 try_files $uri $uri/ /index.html; } location /orion-visor/api { proxy_pass http://service:9200/orion-visor/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; } location /orion-visor/keep-alive { proxy_pass http://service:9200/orion-visor/keep-alive; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; 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_read_timeout 3600s; proxy_send_timeout 3600s; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } }