I’m new to grafana and nginx concepts. I’m trying to setup reverse proxy for grafana and nginx with below configurations
OS: Redhat 7
Grafana: Grafana 6.0
Nginx: nginx/1.14.2
grafana.ini
domain = dsone.3ds.com
protocol = http
http_port = 3000
root_url = ‘%(protocol)s://%(domain)s/grafana’
cert_file=
cert_key=
nginx.conf:
events{
}
http{
server {
listen 85;
root /usr/share/nginx/www;
location /grafana/ {
proxy_pass http://walvrh201mon.dsone.3ds.com/grafana/;
}
}
}
When I hit abouve URL get error as ‘unable to connect’ in browser? Can anyone tell me whether any changes to be done in above configurations or missing anything?
Page: http://walvrh201mon.dsone.3ds.com/;
Grafana Page http://walvrh201mon.dsone.3ds.com/grafana/;
In my opinion, i think that you need change
proxy_pass http://walvrh201mon.dsone.3ds.com/grafana/;
to
proxy_pass http://grafana.staged-by-discourse.com/;
and
root_url = ‘%(protocol)s://%(domain)s/grafana’
to
root_url = ‘%(protocol)s://%(domain)s/grafana/’
Thank you mrobles.
I made the changes as per your suggestion
I’m able to get login page with below url
https://walvrh.dsone.3ds.com/login/
But I want to access it with https://walvrh.dsone.3ds.com/grafana/
My root_url in grafana.ini is https://walvrh.dsone.3ds.com/grafana/
Nginx.conf has
…
location /grafana/
http://localhost:3001/;
Any suggestions would be helpful
You have setted port 3000 on grafana.ini but 3001 in your nginx config
Hi I am unable to Configure Nginx Reverse Proxy For Grafana Access.
My Nginx is working on 443 port and grafana on 3000 port
Config files: -
nginx file
##########################################
[root@ip-172-31-87-127 ~]# vim /etc/nginx/nginx.conf
location = /50x.html {
# }
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
#Settings for a TLS enabled server.
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name 54.210.101.146;
root /usr/share/nginx/html;
ssl_certificate "/etc/pki/nginx/server.crt";
ssl_certificate_key "/etc/pki/nginx/private/server.key";
# It is strongly recommended to generate unique DH parameters
# Generate them with: openssl dhparam -out /etc/pki/nginx/dhparams.pem 2048
#ssl_dhparam “/etc/pki/nginx/dhparams.pem”;
ssl_session_cache shared:SSL:10485760;
ssl_session_timeout 10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:SEED:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!RSAPSK:!aDH:!aECDH:!EDH-DSS-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!SRP;
ssl_prefer_server_ciphers on;
*************************************************************************************
##################### Grafana Configuration Example #####################
Everything has defaults so you only need to uncomment things you want to
change
possible values : production, development
;app_mode = production
instance name, defaults to HOSTNAME environment variable value or hostname if HOSTNAME var is empty
;instance_name = ${HOSTNAME}
#################################### Paths ####################################
[paths]
Path to where grafana can store temp files, sessions, and the sqlite3 db (if that is used)
;data = /var/lib/grafana
Temporary files in data
directory older than given duration will be removed
;temp_data_lifetime = 24h
Directory where grafana can store logs
;logs = /var/log/grafana
Directory where grafana will automatically scan and look for plugins
;plugins = /var/lib/grafana/plugins
folder that contains provisioning config files that grafana will apply on startup and while running.
;provisioning = conf/provisioning
#################################### Server ####################################
[server]
Protocol (http, https, socket)
;protocol = http
The ip address to bind to, empty will bind to all interfaces
;http_addr =
The http port to use
;http_port = 3000
The public facing domain name used to access grafana from a browser
;domain = localhost
Redirect to correct domain if host header does not match domain
Prevents DNS rebinding attacks
;enforce_domain = false
The full public facing url you use in browser, used for redirects and emails
If you use reverse proxy and sub path specify full url (with sub path)
;root_url = http://grafana.staged-by-discourse.com