本文主要是介绍使用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;}
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";
}
这篇关于使用nginx访问wgcloud运维监控系统的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!