server { | |
listen 80; | |
# server_name /; | |
root /usr/share/nginx/html; | |
index index.html index.htm; | |
# redirect server error pages to the static page /50x.html | |
# error_page 500 503 504 /50x.html; | |
# 设置客户端最大可发送的body大小 | |
client_max_body_size 400m; | |
# 解决504 Gateway Timeout错误 | |
# Proxy方式:http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass | |
proxy_buffers 8 128k; | |
proxy_connect_timeout 3000; | |
proxy_read_timeout 3000; | |
proxy_send_timeout 3000; | |
# 发送超时设置,两次发送间隔超过报错 | |
send_timeout 3000; | |
# vue router配置 | |
location / { | |
try_files $uri $uri/ /index.html; | |
} | |
# 正式版配置 | |
location /api { | |
proxy_pass http://${BACKEND_ADDRESS}/api; | |
} | |
} |