记录单页web应用配置
server {listen 8166;server_name 127.0.0.1 localhost m.bank-pay.com;charset utf-8;# 成功日志access_log logs/xueyou-admin.log;# 错误日志error_log logs/xueyou-admin_error.log;index index.html;# 变量设置,设置公共路径set $root /home/servers/xueyou-admin/website/;fastcgi_intercept_errors on;location / {index index.html;root $root;# 单页应用返回固定内容try_files $uri /index.html;}location ^~ /api {# 重写路径,去掉/apirewrite ^/api/(.*) /$1 break;proxy_pass http://192.168.1.26:8053;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 https;proxy_next_upstream off;proxy_connect_timeout 30;proxy_read_timeout 300;proxy_send_timeout 300;}location ^~ /captcha {proxy_pass http://192.168.1.26:8053;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 https;proxy_next_upstream off;proxy_connect_timeout 30;proxy_read_timeout 300;proxy_send_timeout 300;}location ^~ /file {proxy_pass http://192.168.1.26:8053;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 https;proxy_next_upstream off;proxy_connect_timeout 30;proxy_read_timeout 300;proxy_send_timeout 300;}error_page 500 502 503 504 403 404 = @errpage;location @errpage {index index.html;root $root;# 单页应用返回固定内容try_files $uri /index.html;}}
