I am trying to use nginx as a reverse proxy for several web applications deployed in docker containers. I can only open port 80 from the docker server and want to allow access to the shipyard and rabbitMQ management web application.
Ideally, users can access the services through: HTTP [:] // 10.10.10.1/shipyard/ HTTP [:] // 10.10.10.1/rabbitmq/
After quite a bit of research, trial and error, this is my nginx configuration:
upstream rabbitmq {
server 127.0.0.1:8888;
}
upstream shipyard {
server 127.0.0.1:8080;
}
server {
listen 80;
server_name 10.10.10.1;
location /rabbitmq/ {
proxy_http_version 1.1;
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_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_pass http://rabbitmq/;
proxy_redirect default;
}
location /shipyard/ {
proxy_http_version 1.1;
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_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_pass http://shipyard/;
proxy_redirect default;
}
}
When I access any path in applications, I encounter several problems that I think may be related:
Shipyard: Attempts to download files from http [:] // 10.10.10.1/api/containers when it should be http [:] // 10.10.10.1/shipyard/api/containers
RabbitMQ:
, :
+++ PUT: http [:]//10.10.10.1/rabbitmq/api/queues///test2
405 ( ). , /// , rabbitMQ.