【发布时间】:2014-09-07 05:56:37
【问题描述】:
我正在尝试使用一些基本服务来设置 server@home。所有服务都运行在专用 VM 中。每个 VM 都托管在 vSphere 5.5 上。到目前为止我有:
- Debian wheezy 使用 nginx 作为反向代理:192.168.1.12
- Debian wheezy 使用 nodeJS 作为 webapp 服务器:192.168.1.43
- 192.168.1.43:3000 => 在 192.168.1.43:3001 上进行重定向的 http 网络服务器
- 192.168.1.43:3001 => 提供服务的 https 网络服务器
- 安装了 madsonic 的 Debian wheezy:192.168.1.35
- 如文档中所述,我将 --https-port=443 放在配置中以启用 https 访问
我使用 nginx 能够拥有这样的东西:
- myapp.mydomaine.com => 转到 nodejs @ 192.168.1.43
- music.mydomain.com => 转到 madsonic @ 192.168.1.35
我按照教程编辑了 /etc/nginx/sites-enabled 中的“默认”文件。这是它的样子:
server {
listen 80;
server_name myapp.domaine.com;
location / {
proxy_pass http://192.168.1.43:3000;
}
}
server {
listen 443;
server_name myapp.domain.com;
ssl on;
ssl_certificate [...];
ssl_certificate_key [...];
location / {
proxy_pass https://192.168.1.43:3001;
}
}
server {
listen 80;
server_name music.domain.com;
location / {
proxy_pass http://192.168.1.35:4040;
}
}
server {
listen 443;
server_name music.domain.com;
ssl on;
ssl_certificate [...];
ssl_certificate_key [...];
location / {
proxy_pass https://192.168.1.35;
}
}
myapp 上的第一个重定向有效。当我在 madsonic 服务器上只有 http 时,音乐重定向有效。当我在 madsonic 服务器上激活 https 时,我收到 502 Bad gateway 错误(但 Firefox 中的 URL 是 https://music.domain.com)。
我还尝试了其他一些方法,比如这里提到的: How to redirect on the same port from http to https with nginx reverse proxy
也没有用。
我还在 /var/logs/nginx/error.log 中看到 502 错误是由于 SSL_do_handshake 错误 (SSl23_GET_SERVER_HELLO:tlsv1)。不知道是否与 502 错误有关。
我有点困惑,因为其他 https 服务工作正常。有人有建议吗?非常感谢。
【问题讨论】:
标签: nginx reverse-proxy