[nginx]设置代理和静态资源目录

    upstream disconf {
        server 127.0.0.1:8080; #tomcat服务器的地址
    }

    server {
        listen       8091; #监听端口
        server_name  localhost; #域名
        index index.html;
location
/ { root /usr/local/disconf/war/html; #静态资源目录 index index.html; } location ~ ^/(api|export) {
             proxy_pass http://disconf;  #http://后面的要和upstream保持一致
             proxy_set_header X-Real-IP $remote_addr;
             proxy_set_header X-Scheme $scheme;
 
             proxy_pass_header Server;
             proxy_set_header Host $http_host;
             proxy_redirect off;
        }
     }

 

posted on 2018-11-22 10:26  无所住的风  阅读(7742)  评论(0编辑  收藏  举报