Context: I want to configure reverse proxy on NGINX for my grafana server running on local, is there any way I can do it. Didn't find any relative topic.
Note: Cannot use IIS for this.
You need to change few configurations file for this, I guess you must be running Grafana and nginx on your local machine.
Note: Grafana server is running on 3000 and NGINX on 8099(this must be 80 on your machine)
Changes in the Grafana config file,
Navigate to the Grafana config in the installation folder, for me I have used the default.ini
file
Update the value domain = localhost
to domain = my.perfdashboard.local.com
And the root_url = %(protocol)s://%(domain)s:%(http_port)s/
to root_url = http://localhost:3000
(this is not mandatory, but check if it didn't work)
After these changes restart the Grafana server
Changes in the NGINX configuration file
Navigate inside the conf folder inside the installation directory of NGINX.
Inside the https
section please add the following configuration,
map $http_upgrade $connection_upgrade { default upgrade; '' close; }
server { listen 8099; server_name my.perfdashboard.local.com root html; index index.html index.htm;
location / {
proxy_pass http://localhost:3000/;
}
location /api/alive {
rewrite ^/(.*) /$1 break;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $http_host;
proxy_pass http://localhost:3000/;
}
}
Restart the NGINX server
Change the host file on the windows machine,
localhost my.perfdashboard.local.com 127.0.0.1 my.perfdashboard.local.com
Now in the browser type my.perfdashboard.local.com:8099