【发布时间】:2014-09-24 17:12:07
【问题描述】:
我有一个网站,它在一些旧的 ubuntu 服务器上与 apache 完美运行,并且也有 https。但现在由于某些原因,我需要移动到不同的(具有高配置的新 ubuntu 服务器)服务器并尝试使用 Nginx 为我的站点提供服务,因此安装了 nginx(nginx/1.4.6 (Ubuntu))。下面是我的nginx.conf文件设置
server {
listen 8005;
location / {
proxy_pass http://127.0.0.1:8001;
}
location /static/ {
alias /root/apps/project/static/;
}
location /media/ {
alias /root/apps/media/;
}
}
# Https Server
server {
listen 443;
location / {
# proxy_set_header Host $host;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Protocol $scheme;
# proxy_set_header X-Url-Scheme $scheme;
# proxy_redirect off;
proxy_pass http://127.0.0.1:8001;
}
server_tokens off;
ssl on;
ssl_certificate /etc/ssl/certificates/project.com.crt;
ssl_certificate_key /etc/ssl/certificates/www.project.com.key;
ssl_session_timeout 20m;
ssl_session_cache shared:SSL:10m; # ~ 40,000 sessions
ssl_protocols SSLv3 TLSv1; # SSLv2
ssl_ciphers ALL:!aNull:!eNull:!SSLv2:!kEDH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+EXP:@STRENGTH;
ssl_prefer_server_ciphers on;
}
由于我已经在另一台服务器上运行了 https 证书(project.com.crt)和密钥(www.project.com.key),所以我刚刚将它们复制到新服务器(目前不包含任何域,并且只有 IP ) 并放置在路径/etc/ssl/certificates/ 并尝试直接使用它们。现在我重新启动了 Nginx 并尝试使用 https:// 23.xxx.xxx.xx:8005 访问我的 IP 23.xxx.xxx.xx:8005,我在 firefox 中收到以下错误
Secure Connection Failed
An error occurred during a connection to 23.xxx.xxx.xx:8005. SSL received a record that exceeded the maximum permissible length. (Error code: ssl_error_rx_record_too_long)
The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
Please contact the website owners to inform them of this problem. Alternatively, use the command found in the help menu to report this broken site.
但是当我在没有https 的情况下访问 IP 时,我可以为我的网站提供服务。
那么我在上面的 nginx 配置文件中的 Https 设置有什么问题? 我们是否不能通过简单地复制和粘贴到某个文件夹来提供证书文件?我们需要为我的新服务器创建任何额外的证书吗?
【问题讨论】:
-
您没有在客户端尝试连接的端口上侦听 SSL/TLS 服务器。出现
ssl_error_rx_record_too_long是因为 SSL 堆栈试图将 HTTP 响应解释为 SSL/TLS 数据。
标签: ssl nginx ubuntu-13.10