1.nginx settings
server { listen 127.0.0.1:80; #server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; # proxy_pass http://127.0.0.1:9090/; } location /grafana/ { proxy_pass http://10.xx.xxx.55:3000/; } location /promethues/ { proxy_pass http://10.xx.xxx.55:9090/prometheus/; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }
2. Set prometheus subpath
Next you need is to prometheus and grafana start or make some changes in the configuration file, prometheus is relatively simple, the main time to really start sub-path according to the command-line parameter settings.
At startup settings web.external-url
using the following command:
./prometheus --web.external-url=prometheus --config.file=prometheus.yml
Start the service, the results shown:
3. Set grafana subpath
grafana agents need default.ini
configuration
# The full public facing url root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana
Restart the service, the results shown: