Change Grafana Default Port

Change Grafana Default Port

Channel:
Subscribers:
24,900
Published on ● Video Link: https://www.youtube.com/watch?v=OUN3ha9fyh0



Duration: 1:30
218 views
6


Article : https://medium.com/grafana-tutorials/change-grafana-default-port-46ba53d628e9

I change the default Grafana web server port from 3000 to 443 since I now have an SSL certificate bound which I setup in https://medium.com/grafana-tutorials/adding-ssl-to-grafana-eb4ab634e43f

Port 443 is the default port used when you type a https:// url into the browser. Currently my Grafana Server is accessed via adding the port number to the URL, I want to access it by not needing to add the port number 3000 to the end of the URL.

You have the option to change the port number to 443 in the /etc/grafana.ini file, but since Grafana doesn’t have root privileges in Linux, it will fail to restart when trying to serve from port 443. So instead of giving the Grafana process itself escalated root privileges which would make it less secure, I use the iptables prerouting method.

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

The iptables prerouting method will redirect any external tcp requests to port 443 onto the internal port 3000 which the Grafana server process is already listening on.







Tags:
grafana
grafana port
iptables prerouting
grafana engineer