天天看点

使用nginx访问wgcloud运维监控系统

1.nginx配置如下:

访问地址如:http://172.17.188.27/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端口也要写上,如下

#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;
        }      
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";
}      

继续阅读