美文网首页
tomcat nginx 实现动静分离

tomcat nginx 实现动静分离

作者: Herman7z | 来源:发表于2018-03-22 14:40 被阅读0次
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;
        }



    }

相关文章

网友评论

      本文标题:tomcat nginx 实现动静分离

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