nginx 动静态分离demo
程序员文章站
2024-02-14 16:09:58
...
server {
listen 80;
server_name www.zhaosc.com;
index index.jsp index.html index.htm;
root /usr/local/nginx/html;
location /
{
proxy_next_upstream http_502 http_504 error timeout invalid_header;
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://web1;
}
# location ~ .*\.(php|jsp|cgi|shtml)?$
# {
# 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://jvm_web2;
# }
location ~ .*\.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css)$
{
root /var/local/static;
expires 30d;
}
access_log /usr/local/logs/web2/access.log main;
error_log /usr/local/logs/web2/error.log crit;
}
转载于:https://www.jianshu.com/p/62d6fcc989c8
上一篇: Ubuntu系统双网卡的配置
下一篇: kali修改用户名与密码