[转帖]Grafana背后的Nginx和Apache Proxy

Grafana背后的Nginx和Apache Proxy

https://ywnz.com/linuxyffq/5590.html

这个网站貌似很是很是好

 

在本文中,我将向你展现如何在Nginx和Apache Web服务器以后部署Grafana来代理全部访问请求,此配置假设你已准备好Grafana安装,请参考在CentOS 7上安装Grafana的方法在Ubuntu 18.04系统中安装Grafana 6的方法html

 

Nginx背后的Grafanalinux

若是你使用Nginx做为Web服务器,则配置将与Apache不一样,使用以下内容建立nginx配置文件:nginx

server {web

listen 80;apache

root /usr/share/nginx/www;服务器

index index.html index.htm;dom

location / {网站

proxy_pass http://localhost:3000;spa

proxy_set_header    Host             $host;代理

proxy_set_header    X-Real-IP        $remote_addr;

proxy_set_header    X-Forwarded-For  $proxy_add_x_forwarded_for;

}

若是你启用了ssl,请添加:

listen 443 ssl; 

ssl_certificate /certpath

ssl_certificate_key  /certkeypath

确认配置语法并从新启动nginx:

# nginx -t

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

nginx: configuration file /etc/nginx/nginx.conf test is successful

# service nginx restart

 

Apache背后的Grafana

若是你正在运行Apache Web服务器,则能够添加具备相似于如下配置的VirtualHost:

<VirtualHost *:80>

DocumentRoot /var/www/html/

ServerAdmin webmaster@domain.com

ServerName grafana.domain.com

ProxyPreserveHost On

ProxyPass / http://localhost:3000/

ProxyPassReverse / http://localhost:3000/

ErrorLog logs/grafana_error_log

TransferLog logs/grafana_access_log

</VirtualHost>

确认配置正常并重启apache服务器:

# apachectl -t

Syntax OK

至此,应该可以使用服务器主机名访问Grafana仪表板。

相关文章
相关标签/搜索