我有两个在docker容器中运行的tomcat Web应用程序。我想正确配置,以便它们在不同的端口上运行...:
http:[ipaddress] http:[ipaddress]:81
但是,当我进入第二个tomcat网站时,我被重定向回80端口。...有什么建议吗?
server {
listen 80 default_server;
server_name 1.1.1.1;
location / {
proxy_pass http://web1:8080;
proxy_redirect http://web1:8080 $scheme://localhost;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 150;
proxy_send_timeout 100;
proxy_read_timeout 100;
proxy_buffers 4 32k;
client_max_body_size 0;
client_body_buffer_size 128k;
}
access_log /var/log/nginx/1.access.log;
error_log /var/log/nginx/1.error.log;
}
server {
listen 81 default_server;
server_name 1.1.1.1;
location / {
proxy_pass http://web2:8080;
proxy_redirect http://web2:8080 $scheme://localhost;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 150;
proxy_send_timeout 100;
proxy_read_timeout 100;
proxy_buffers 4 32k;
client_max_body_size 0;
client_body_buffer_size 128k;
}
}
非常感谢!