概述
我原来是这么配置的
upstream web.xxx.com {
sticky;
server 192.168.1.171:8080 max_fails=1 fail_timeout=10s;
server 192.168.1.175:8080 max_fails=1 fail_timeout=10s;
}
server {
listen 80;
server_name web.xxx.com;
location / {
proxy_pass http://web.xxx.com/;
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_connect_timeout 1;
proxy_read_timeout 30;
}
location /img {
root /usr/local/www/nginx;
proxy_connect_timeout 1;
proxy_read_timeout 10;
}
rewrite ^(.*);jsessionid=(.*)$ $1 break;
underscores_in_headers on;
}
现在 我新加了个server
server {
listen 80;
server_name store.xxx.com;
location / {
proxy_pass http://192.168.1.171:8080/store/;
proxy_redirect off;
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_connect_timeout 1;
proxy_read_timeout 30; }
location /img {
root /usr/local/www/nginx;
proxy_connect_timeout 1;
proxy_read_timeout 10;
}
rewrite ^(.*);jsessionid=(.*)$ $1 break;
underscores_in_headers on;
}
最后
以上就是粗犷热狗为你收集整理的nginx + 多tomcat 配置多域名的全部内容,希望文章能够帮你解决nginx + 多tomcat 配置多域名所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复