🔌 Configuration

Change Grafana Port from 3000 on Windows

Grafana listens on port 3000 by default. This guide explains how to change it to any other port using grafana.ini, update the Windows Firewall rules and troubleshoot port conflicts.

Why change the default port?

Step 1 — Edit grafana.ini

Open C:\Program Files\GrafanaLabs\grafana\conf\grafana.ini as Administrator and find the [server] section:

[server] # Change 3000 to your desired port http_port = 3001
Tip: Choose a port above 1024 to avoid needing special Windows privileges. Common alternatives: 3001, 8080, 8088, 9000.

Step 2 — Update Windows Firewall rule

# Remove old firewall rule for port 3000 Remove-NetFirewallRule -DisplayName "Grafana Web UI (Port 3000)" -ErrorAction SilentlyContinue # Add new rule for the new port (e.g. 3001) New-NetFirewallRule ` -DisplayName "Grafana Web UI (Port 3001)" ` -Direction Inbound ` -Protocol TCP ` -LocalPort 3001 ` -Action Allow

Step 3 — Restart Grafana service

Restart-Service -Name "Grafana" # Wait a few seconds then verify the new port Start-Sleep -Seconds 4 Invoke-WebRequest -Uri "http://localhost:3001" -UseBasicParsing

Step 4 — Update root_url if behind a proxy

If Grafana is behind Nginx or IIS, update your proxy configuration and the root_url in grafana.ini:

[server] http_port = 3001 root_url = https://grafana.yourdomain.com/ # In nginx.conf, update proxy_pass: # proxy_pass http://localhost:3001;

Find what process is using port 3000

If you're changing the port because of a conflict, first identify the conflicting process:

# Find PID using port 3000 netstat -ano | findstr ":3000" # Get process name from PID (replace 1234 with actual PID) Get-Process -Id 1234 | Select-Object Name, Id, Path # Stop the process if it's safe to do so Stop-Process -Id 1234 -Force

Run multiple Grafana instances on different ports

To run two Grafana instances on the same server, install each with a different data directory and configure separate ports:

# Instance 1: default install at port 3000 # Instance 2: custom install using environment variable $env:GF_SERVER_HTTP_PORT = "3001" $env:GF_PATHS_DATA = "C:\grafana-instance2\data" $env:GF_PATHS_LOGS = "C:\grafana-instance2\logs" # Register as a separate service sc.exe create Grafana2 ` binPath= "C:\grafana2in\grafana-server.exe --config=C:\grafana2\conf\grafana.ini" ` start= auto ` DisplayName= "Grafana Instance 2"