nginx 同一域名下 多個tomcat應用
阿新 • • 發佈:2019-02-08
同一域名www.xxxxx.com
http://localhost:8080 存放專案名為ROOT 結果訪問為:www.xxxxx.com
http://localhost:8081 存放專案為aiwen 結果訪問為:www.xxxxx.com/aiwen
server {
listen 80;server_name www.xxxxx.com;
location / {
proxy_pass http://localhost:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 100m;
root html;
index index.html index.htm;
}
location /aiwen {
proxy_pass http://localhost:8081/aiwen;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 100m;
root html;
index index.html index.htm;
}
}