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;
        }
     }

猜你喜欢

转载自www.cnblogs.com/afeng2010/p/9999485.html