标签:col cer connect pass file 配置 res temp pre
目的:通过Nginx服务器对grafana进行代理,实现通过https://域名/grafana在公网进行访问
1、修改Nginx配置(nginx.conf)文件,添加访问grafana的配置,配置时注意proxy_pass后面一定要有符号 /(目的是去掉/grafana/以匹配本身)
vi /usr/local/nginx/conf/nginx.conf
server {
listen 443 ssl;
server_name example.com;
ssl_certificate cert/example.com.pem;
ssl_certificate_key cert/example.com.key;
location / {
root html;
index index.html index.htm;
}
location /grafana/ {
root html;
index index.html index.htm;
proxy_pass http://192.168.31.90:3000;
proxy_redirect default;
proxy_max_temp_file_size 0k;
proxy_connect_timeout 30;
proxy_send_timeout 60;
proxy_read_timeout 60;
proxy_next_upstream error timeout invalid_header http_502;
}
}
2、修改grafana服务器的配置文件(grafana.ini),注意需要去掉行前的注释符号 “;”
[server]段涉及以下三处需要更改:
[server]
domain = 填写你的域名地址
root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana/
serve_from_sub_path = true
3、reload Nginx并重启grafana服务
/usr/local/nginx/sbin/nginx -t
/usr/local/nginx/sbin/nginx -s reload
systemctl restart grafana-server
4、最后提供下官方文档中关于转发的配置说明:
grafana之proxy转发说明
转发配置如下:
[server]
domain = example.com
root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana/
serve_from_sub_path = true
标签:col cer connect pass file 配置 res temp pre
原文地址:https://blog.51cto.com/8355320/2526555