RabbitMQ is an open-source message broker that enables distributed applications to communicate through message queues, decoupling producers and consumers across services. This guide installs RabbitMQ on Ubuntu 26.04, enables the management plugin, creates an admin user, and secures the web dashboard with Nginx and a Let's Encrypt certificate. By the end, you'll have RabbitMQ running with a secure management interface accessible over HTTPS.
Install RabbitMQ
RabbitMQ is available in Ubuntu 26.04's default APT repository.
1. Update the APT package index:
$ sudo apt update
2. Install Erlang and RabbitMQ:
$ sudo apt install gnupg erlang rabbitmq-server -y
What you just installed:
-
erlang: the runtime RabbitMQ is built on -
rabbitmq-server: the message broker daemon
3. Verify the installed version:
$ rabbitmq-diagnostics --version
Manage the RabbitMQ Service
Enable RabbitMQ to start automatically when the server boots.
1. Enable and start the service:
$ sudo systemctl enable rabbitmq-server
$ sudo systemctl start rabbitmq-server
2. Check the service status:
$ sudo systemctl status rabbitmq-server
3. Stop or restart the service when needed:
$ sudo systemctl stop rabbitmq-server
$ sudo systemctl restart rabbitmq-server
Configure RabbitMQ
1. Enable the management plugin:
$ sudo rabbitmq-plugins enable rabbitmq_management
2. Create an admin user:
$ sudo rabbitmqctl add_user example_admin strong_password
3. Grant the user administrator permissions:
$ sudo rabbitmqctl set_user_tags example_admin administrator
4. Set resource permissions for the default virtual host:
$ sudo rabbitmqctl set_permissions -p / example_admin ".*" ".*" ".*"
The three permission patterns grant configure, write, and read access on all resources in the / virtual host.
Configure Firewall Rules
$ sudo ufw allow 80/tcp
$ sudo ufw allow 443/tcp
Configure Nginx as a Reverse Proxy
The RabbitMQ management interface listens on port 15672. Proxy it through Nginx on port 80.
1. Install Nginx:
$ sudo apt install nginx -y
2. Enable and start Nginx:
$ sudo systemctl enable nginx
$ sudo systemctl start nginx
3. Create the reverse proxy configuration:
$ sudo nano /etc/nginx/sites-available/rabbitmq.example.com.conf
server {
listen 80;
server_name rabbitmq.example.com;
location / {
proxy_pass http://localhost:15672;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
4. Enable the site and reload Nginx:
$ sudo ln -s /etc/nginx/sites-available/rabbitmq.example.com.conf /etc/nginx/sites-enabled/
$ sudo nginx -t
$ sudo systemctl reload nginx
Secure with Let's Encrypt SSL
1. Install Certbot with the Nginx plugin:
$ sudo apt install certbot python3-certbot-nginx -y
2. Generate and install the certificate:
$ sudo certbot --nginx -d rabbitmq.example.com --agree-tos
Certbot updates the Nginx configuration to redirect HTTP to HTTPS automatically.
3. Test the auto-renewal timer:
$ sudo certbot renew --dry-run
Access the Dashboard
Open https://rabbitmq.example.com in a browser and log in with the admin credentials you created. The management interface shows queues, exchanges, connections, and message rates.
Next Steps
RabbitMQ is now running with a secured management interface. From here you can:
- Create queues and exchanges through the management dashboard or API
- Integrate RabbitMQ with a Python application using the
pikalibrary - Set up clustering with additional RabbitMQ nodes for high availability
For the full guide with additional tips, visit the original article on Vultr Docs.
Top comments (0)