Nginx.conf
upstream tomcat1{
server 127.0.0.1:8080;
}
upstream tomcat2{
server 127.0.0.1:8081;
}
server {
listen 80;
server_name abc.com;
location / {
proxy_pass http://tomcat2;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen 80;
server_name abcd.com abcdef.com;
# root /rest_html/;
# index index.html;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
# root html;
# index index.html index.htm;
#域名www.test1.com的请求全部转发到tomcat_server1即tomcat1服务上
proxy_pass http://tomcat1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于