The RabbitMQ team monitors this mailing list and only sometimes answers questions on StackOverflow.
When asking for assistance, it helps people if you provide complete configuration files rather than just a snippet as you have done.
This is a complete configuration that redirects localhost:8888/rabbitmq
to the management server running on port 15672
. I have tested it with nginx
1.14.0
and RabbitMQ 3.7.6
. I am only prompted to log in once. I ran it as my normal user with this command:
nginx -p /home/lbakken/issues/SO/rabbitmq-nginx-config-48881248 -c nginx.conf
user lbakken lbakken;
worker_processes 1;
# Note: for debugging, very useful
# error_log /dev/stderr debug;
error_log /dev/stderr;
pid nginx.pid;
worker_rlimit_nofile 1024;
daemon off;
events {
worker_connections 1024;
}
http {
client_body_temp_path /tmp/nginx;
fastcgi_temp_path /tmp/nginx;
scgi_temp_path /tmp/nginx;
uwsgi_temp_path /tmp/nginx;
proxy_temp_path /tmp/nginx;
access_log /dev/stdout;
upstream rabbitmq {
least_conn;
server localhost:15672 weight=10 max_fails=3 fail_timeout=30s;
}
server {
listen 8888;
server_name 127.0.0.1;
# Note: a big thanks to this answer:
# https://stackoverflow.com/a/37584637
location /rabbitmq/api/ {
rewrite ^ $request_uri;
rewrite ^/rabbitmq/api/(.*) /api/$1 break;
return 400;
proxy_pass http://rabbitmq$uri;
}
location /rabbitmq {
rewrite ^/rabbitmq$ /rabbitmq/ permanent;
rewrite ^/rabbitmq/(.*)$ /$1 break;
proxy_pass http://rabbitmq;
proxy_buffering off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
}