情景

使用服务器A的Nginx Proxy Manager反代搭建在服务器B的CloudPanel面板上的站点。
情景参考:https://github.com/cloudpanel-io/cloudpanel-ce/issues/214
实际上官方于issue中给出了回复:

With the latest nginx update, we have added a default vhost to avoid direct ip access, see the following file:
/etc/nginx/sites-enabled/default.conf
The proxy manager should work but make sure to forward the $HOST header.

解决方法

NPM反代的源站处设置:Advanced——Custom Nginx Configuration

location / {
    proxy_pass $forward_scheme://$server:$port;
    proxy_set_header Host $host;
    proxy_ssl_name $host;
    proxy_ssl_server_name on;
    proxy_redirect $forward_scheme://$server:$port /;
}

方案来源:cloudpanel.io - Has anyone successfully configured npm infront of a website hosted on this platform?
此为有效解决办法,但由于本人小白,不明原理,故请理解的大佬留言。

NPM反向代理CloudPanel面板报错502 Bad Gateway

https://bluish.cc/archives/2110/

作者

bluish

发布时间

2024-08-30

许可协议

CC BY-SA 4.0

标签: debug, 服务器, cloudpanel, npm

添加新评论