nginx配置访问WGCLOUD页面URL地址不加后缀/wgcloud

nginx配置如下

这样就可以通过域名或IP直接访问WGCLOUD页面了,不用再加后面的/wgcloud了

提示:v3.4.7版本开始,访问server已经不需要加/wgcloud了,不需要在nginx特殊配置处理了。之前的版本还是要加/wgcloud

注意把localhost改为自己的实际server主机IP

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            proxy_pass http://localhost:9999/wgcloud/login/toLogin;
            proxy_cookie_path /wgcloud/ /;
            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_intercept_errors on;
        }
 
        location /wgcloud/ {
            proxy_pass http://localhost:9999/wgcloud/;
            proxy_cookie_path /wgcloud/ /;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
        

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

    }

修改完nginx配置后,重启下nginx

root@vultr:/etc/nginx# /usr/sbin/nginx -s reload

 

posted @ 2022-10-20 14:26  沧海1980  阅读(455)  评论(0编辑  收藏  举报