[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;
        }
     }
相關文章
相關標籤/搜索