美文网首页
nginx 动静态分离demo

nginx 动静态分离demo

作者: 农民工进城 | 来源:发表于2018-04-16 15:13 被阅读0次
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;

    }

相关文章

网友评论

      本文标题:nginx 动静态分离demo

      本文链接:https://www.haomeiwen.com/subject/qdrekftx.html