【发布时间】:2021-11-30 07:32:50
【问题描述】:
我正在尝试将自定义服务安装到我们的一个公司服务器(那些未连接到互联网的服务器,除非所有流量都传递到公司代理)。
此代理已使用 .bashrc 文件中的经典 export http_proxy=blablabla 进行设置。
现在是有趣的部分。我正在尝试配置 nginx 以将所有流量从 server_name 重定向到本地 url localhost:3000
这是我使用的基本配置。没什么太棘手的。
server {
listen 443 ssl;
ssl_certificate /crt.crt;
ssl_certificate_key /key.key;
server_name x.y.z;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass &http_upgrade;
}
}
-
当我尝试从浏览器访问
server_name时,我收到 502 错误(一个 nginx 错误,因此请求会到达我的服务器)。 -
当我尝试从服务器访问本地 url
curl --noproxy '*' https://localhost:3000时,它正在工作。 (由于.bashrc文件中的export http_proxy=blablabla设置,我必须编写--noproxy '*'标志。如果我不写这个,本地主机请求将发送到我们的远程代理,导致请求失败)
我的猜测是这必须与公司代理配置有关,但我可能误导了。
您对此有什么见解可以与我分享吗?
非常感谢!
- PS:该问题与任何类型的 SSL 配置都无关,这部分运行良好
- PS2:我不是系统管理员,所有这些问题都令人困惑
- PS3:我正在使用的服务器是 RHEL 7.9
【问题讨论】: