8.04 Reverse Proxy Grafana with Nginx - MartinWong06/grafana GitHub Wiki

Install nginx in your machine

sudo apt install nginx -y

Verify the nginx installation package

nginx -v
sudo service nginx status

Allow Nginx HTTP pass through your firewall

sudo ufw allow 'nginx HTTP'

For encrypted (https) traffic

sudo ufw allow 'nginx https'

To allow both

sudo ufw allow 'nginx full'

Access to default nginx configuration path

cd /etc/nginx/sites-enabled

Create a nginx configuration

sudo nano your_domain.conf

Example Nginx configuration

server {
    listen 80;
    listen [::]:80;

    server_name your_domain www.your_domain;
        
    location / {
        proxy_pass http://localhost:3000;
        include proxy_params;
    }
}

Restart the service to ensure Nginx will reload the latest changes.

sudo service nginx restart
sudo service nginx status

If default configuration file still exist, need to remove it by following command

sudo rm /etc/nginx/sites-enabled/default
⚠️ **GitHub.com Fallback** ⚠️