NPM反向代理CloudPanel面板报错502 Bad Gateway 作者: bluish 时间: 2024-08-30 分类: 折腾 ##情景 使用**服务器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?][1] 此为有效解决办法,但由于本人小白,不明原理,故请理解的大佬留言。 [1]: https://www.reddit.com/r/nginxproxymanager/comments/11ob47i/comment/lgy5qh0/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button NPM反向代理CloudPanel面板报错502 Bad Gateway http://bluish.net/archives/2110/ 作者 bluish 发布时间 2024-08-30 许可协议 CC BY-SA 4.0 复制版权信息 标签: debug, 服务器, cloudpanel, npm