当前位置: 首页 > 工具软件 > WGCLOUD > 使用案例 >

如何实现URL不加后缀/wgcloud访问WGCLOUD页面

法弘壮
2023-12-01

nginx配置如下

这样就可以通过域名或IP直接访问WGCLOUD页面了,不用再加后面的/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

 类似资料: