【发布时间】:2018-03-09 07:45:01
【问题描述】:
我正在使用部署在 Ubuntu Server 中的简单“hello world”Express.JS(8080 端口)应用程序,NGINX 反向代理设置如下。
该应用程序适用于 http 端口但不适用于 https 端口
- nginx 版本:nginx/1.10.3 (Ubuntu)
- OpenSSL 1.0.2g 2016 年 3 月 1 日
而我的配置文件是这样的:
server {
listen 80;
listen 443 default ssl;
server_name localhost;
ssl_certificate /root/mydir/ssl/certificate.crt;
ssl_certificate_key /root/mydir/ssl/private.key;
location / {
proxy_pass http://localhost:8080;
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;
}
}
配置对于我的域 testdomain.com 的 http 连接工作正常,但对于 https://testdomain.com 或 https://www.testdomain.com 完全失败
这个配置出了什么问题?
SSL 证书由 sslforfree.com 生成。
【问题讨论】:
标签: node.js nginx https reverse-proxy