Change Default Port


I change the default Grafana web server port from 3000 to 443 since we now have an SSL certificate bound.


You can change the port number to 443 in the grafana.ini file, but since Grafana doesn't have root privileges, it will fail when trying to server from port 443. So instead of giving the Grafana process root privileges, I use the prerouting method described below.

I use the iptables prerouting method

sudo iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 3000

You can inspect the iptables settings using

iptables -t nat -L


iptables settings will be lost in case of system reboot. You will need to reapply them manually,


install iptables-persistent

sudo apt install iptables-persistent

This will save your settings into two files called,



Any changes you make to the iptables configuration won't be auto saved to these persistent files, so if you want to update these files with any changes, then use the commands,

iptables-save > /etc/iptables/rules.v4

iptables-save > /etc/iptables/rules.v6