DEV Community

Cover image for [ByteSize] RabbitMQ management UI and Nginx
Dave O'Dea
Dave O'Dea

Posted on

[ByteSize] RabbitMQ management UI and Nginx

I originally posted this article on my own site - stop by and say hi!😀

Because of the nature of how RabbitMQ structures its API endpoints and for other reasons I won't get into here (hence Byte-size), I've previously struggled with getting the RabbitMQ management plugin UI available at a URL route controlled by Nginx.

Hopefully, this will save you the same headaches I endured ...
Of course, you'll want to make sure you have both RabbitMQ and Nginx installed on your system.

Nginx configuration
Let's firstly setup our nginx.conf file:
sudo vim /etc/nginx/nginx.conf

upstream rabbitmq {
        server localhost:15672 weight=10 max_fails=3 fail_timeout=30s;
Enter fullscreen mode Exit fullscreen mode

Next, let's edit add location blocks for RabbitMQ:
sudo vim /etc/nginx/sites-enabled/default

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;
Enter fullscreen mode Exit fullscreen mode

Reload your Nginx config:
nginx -s reload

Ensure you have the RabbitMQ management plugin enabled:
rabbitmq-plugins enable rabbitmq_management

Now, you can head over to and the RabbitMQ login screen will be available.

Thank you for reading,️
~ Dave

Thanks to lukebakken for inspiration I got from their gist on Github, original here.

Top comments (0)