tomcat nginx 实现动静分离
2018-03-22 本文已影响0人
Herman7z
server {
listen 80;
server_name pm.shiwaixiangcun.cn;
#charset koi8-r;
access_log logs/pm.access.log main;
root html/property;
index index.html;
location /static/ {
root html/property;
}
location /resources/ {
root html;
expires 30d;
}
location ~ /.*\.(json|pdf|xls)$ {
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_pass http://127.0.0.1:82;
client_max_body_size 1000m;
}
#如果没有匹配的请求都重新转发到index.html
location ~* .* {
root html
index index.html;
try_files $uri $uri/ /index.html
}
error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location = /404.html {
root html;
}
}