使用nginx訪問wgcloud運維監控系統


1.nginx配置如下:

比如nginx部署172.17.188.27主機上,server也在172.17.188.27上,訪問地址如:http://172.17.188.27/wgcloud 

提示:v3.4.7開始 訪問地址已經不需要加/wgcloud了

 
    server {
        listen       80;
        server_name  localhost;
 
        #charset koi8-r;
 
        #access_log  logs/host.access.log  main;
 
        location / {
            proxy_pass http://127.0.0.1:9999;
            #root   html;
            #index  index.html index.htm;
        }
 
 
        #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;
        }
 
        # 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;
        #}
    }

 

2.記得agent的配置文件項serverUrl的80端口也要寫上,如下

agent如果依然可以上報數據,就可以不用修改如下配置

#wgcloud-server端訪問地址,端口一定要寫,即使是80也要寫哈
serverUrl=http://172.17.188.27:80

 

3.https訪問時候需要注意,配置有所不同,修改如下

location / {
            proxy_pass http://127.0.0.1:9999;
            proxy_redirect http:// https://;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto https;
        }

4.wss反向代理使用說明,在使用https時候頁面會啟用wss協議,端口為443,前端訪問變為如wss:domain:443/ws,nginx接入443端口后配置如下

location /ws
{
    proxy_pass http://127.0.0.1:9998;
 
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM