我正在运行 2 个 geoserver 和 nginx 容器。我想调用https://xxx.xxx.com/geoserver另一个https://xxx.xxx.com/geoserver2。geoserver 容器在代理容器后面运行。这是默认的 domain.com/geoserver 配置。
location /geoserver {
add_header Front-End-Https on;
add_header Cache-Control "public, must-revalidate";
add_header Strict-Transport-Security "max-age=2592000; includeSubdomains";
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded_For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://geoserver_geoserver_1:8080/geoserver;
}
我怎样才能调用domain.com/geoserver2?我正在尝试一些配置,但是当我尝试登录时,域重定向geoserver_geoserver_1这个容器。但geoserver2应该运行geoserver_geoserver_2这个容器。
location /geoserver2/ {
add_header Front-End-Https on;
add_header Cache-Control "public, must-revalidate";
add_header Strict-Transport-Security "max-age=2592000; includeSubdomains";
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded_For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://geoserver_geoserver_2:8080/geoserver/;
proxy_redirect /geoserver /geoserver2;
}