天天看點

nginx 做elk、prometheus等通路控制

參考 

https://blog.csdn.net/weixin_39947101/article/details/106628221

https://www.cnblogs.com/jugglee/p/8857994.html

https://www.cnblogs.com/zhizhu1120418975/p/11639730.html

https://www.cnblogs.com/caoweixiong/p/12155712.html

1.取消grafana密碼限制

cd /etc/grafana/

vim grafana.ini
           
[auth.anonymous]
# enable anonymous access
enabled = true

# specify organization name that should be used for unauthenticated users
org_name = Sinosoft   #改為自己的組名

# specify role for unauthenticated users
org_role = Admin   #所有權限
           

重新開機grana

進入grafana修改org名字後即可五密碼登入

2.nginx代理kibana

server {
        listen       80;
        server_name  localhost;

        location /kibana {
                proxy_pass http://kibanaIP:5601/; #kibana通路位址
                rewrite ^/kibana/(.*)$ /$1 break;
        }

    }
           
vim kibana.yml
           
server.basePath: "/kibana" #配置該項以後通路kibana都需要在端口後跟“kibana”
           

3.nginx代理prometheus

nginx配置

location /prometheus/ {
        proxy_pass http://prometheusIP:9090/prometheus/;
}
           

在啟動prometheus的時候設定

web.external-url

使用下面的指令:

./prometheus --web.external-url=prometheus
           

4.nginx代理grafana

nginx配置

location /grafana/ {
        proxy_pass http://grafanaIP:3000/;
}
           

部署grafana的伺服器

vim /etc/grafanagrafana.ini
           
# The full public facing url
root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana
           

5.nginx代理springboot-admin

springboot-admin配置檔案

spring:
  application:
    name: admin-server
  boot:
    admin:
      notify:
        mail:
          to: [email protected]
          from: [email protected]
      ui:
        public-url: http://172.17.21.229:80
  mail:
    host: smtp.163.com
    username: [email protected]
    password: 710918wf
    default-encoding: UTF-8
    properties:
      mail:
        smtp:
          auth: true
          starttls:
            enable: true
            required: true
server:
  port: 8888
  servlet:
    context-path: /admin
           

nginx配置

location /admin {
                proxy_pass http://springbootadminIP:8888;
                rewrite ^~/admin/(.*) /$1 break;
}
           

6.nginx代理nacos

location  /nacos/ {
                proxy_pass http://nacosIP:8848/nacos/;
}
           

繼續閱讀