这在过去的几天里一直在困扰着我,我似乎无法弄清楚发生了什么事情。 我有一个新的服务器我安装(使用灶神星 ,与Nginx)。 他们有一个使用LetsEncrypt的内置工具,据说这已经奏效了:
…然后正在编辑的域名:
snginx.conf文件具有(和那些文件确实存在)中的设置:
ssl_certificate /home/admin/conf/web/ssl.steampj.com.pem; ssl_certificate_key /home/admin/conf/web/ssl.steampj.com.key;
定义server {时我也有这个server { bit:
server { listen 443 ssl; listen [::]:443 ssl;
重新启动/重新加载nginx时,我没有得到任何错误。 你当你走到这里,你会得到一个错误: https : //steampj.com/
和:
我很困惑,为什么它不工作
以下是该域的完整server {}条件:
server { listen 443 ssl; listen [::]:443 ssl; server_name steampj.com www.steampj.com; root /home/admin/web/steampj.com/public_html; index index.php index.html index.htm; access_log /var/log/nginx/domains/steampj.com.log combined; access_log /var/log/nginx/domains/steampj.com.bytes bytes; error_log /var/log/nginx/domains/steampj.com.error.log error; ssl_certificate /home/admin/conf/web/ssl.steampj.com.pem; ssl_certificate_key /home/admin/conf/web/ssl.steampj.com.key; location / { location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ { expires max; } location ~ [^/]\.php(/|$) { fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; if (!-f $document_root$fastcgi_script_name) { return 404; } fastcgi_pass 127.0.0.1:9005; fastcgi_index index.php; include /etc/nginx/fastcgi_params; } } error_page 403 /error/404.html; error_page 404 /error/404.html; error_page 500 502 503 504 /error/50x.html; location /error/ { alias /home/admin/web/steampj.com/document_errors/; } location ~* "/\.(htaccess|htpasswd)$" { deny all; return 404; } location /vstats/ { alias /home/admin/web/steampj.com/stats/; include /home/admin/web/steampj.com/stats/auth.conf*; } include /etc/nginx/conf.d/phpmyadmin.inc*; include /etc/nginx/conf.d/phppgadmin.inc*; include /etc/nginx/conf.d/webmail.inc*; include /home/admin/conf/web/snginx.steampj.com.conf*; }
我想知道防火墙是否阻塞了,但似乎是在ufw设置为open:
root@com:~# ufw status Status: active To Action From -- ------ ---- 8181 ALLOW Anywhere 443 ALLOW Anywhere 8181 (v6) ALLOW Anywhere (v6) 443 (v6) ALLOW Anywhere (v6)
接着:
root@com:~# lsof -OnP | grep LISTEN nginx 2382 root 22u IPv4 95181 0t0 TCP 213.219.38.44:443 (LISTEN) nginx 2382 root 45u IPv6 264609 0t0 TCP *:443 (LISTEN) nginx 2637 www-data 22u IPv4 95181 0t0 TCP 213.219.38.44:443 (LISTEN) nginx 2637 www-data 45u IPv6 264609 0t0 TCP *:443 (LISTEN) nginx 2638 www-data 22u IPv4 95181 0t0 TCP 213.219.38.44:443 (LISTEN) nginx 2638 www-data 45u IPv6 264609 0t0 TCP *:443 (LISTEN)
更新2:我设法得到ipv6东西与http。 这是ufw由于某种原因阻塞了端口(禁用它,并罚款…这是好的,因为我们有iptables和fail2ban无论如何)
我仍然无法得到它连接openssl或curl在ipv4虽然:/
root@steamdev2:~# curl -Iv4 https://steampj.com/ * Hostname was NOT found in DNS cache * Trying 213.219.38.44... * Connected to steampj.com (213.219.38.44) port 443 (#0) * successfully set certificate verify locations: * CAfile: none CApath: /etc/ssl/certs * SSLv3, TLS Unknown, Unknown (22): * SSLv3, TLS handshake, Client hello (1): * error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol * Closing connection 0 curl: (35) error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol root@steamdev2:~# openssl s_client -connect steampj.com:443 CONNECTED(00000003) 139846633119256:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:794: --- no peer certificate available --- No client certificate CA names sent --- SSL handshake has read 7 bytes and written 315 bytes --- New, (NONE), Cipher is (NONE) Secure Renegotiation IS NOT supported Compression: NONE Expansion: NONE ---
更新3:我不知道这是否可能是问题,但我注意到我的其他服务器(我几个星期前安装),使用nginx 1.10.0 ,而这个新的使用1.11.13 。 ..也许有一个错误?
您的证书似乎工作得很好,即使在严格的政策的Android上。
根据评论:
我检查了你的SOA系列,从昨天开始是2017040741 ,你的TTL设置为24小时。 问题很可能是您的recursionDNS服务器的DNScaching中存在错误的IP地址,以及一个LetsEncrypt使用的IP地址。 (任何帮助你的人都没有caching过。)
明天再试。 从这里,也可以使用更短的TTL ,例如21600小时。
更新:昨天证书似乎很好,但现在我有ERR_SSL_PROTOCOL_ERROR 。
有了详细的curl模式,我可以看到实际的问题:
curl -v -ipv4 https://steampj.com/ * About to connect() to steampj.com port 443 (#0) * Trying 213.219.38.44... * connected * Connected to steampj.com (213.219.38.44) port 443 (#0) * successfully set certificate verify locations: * CAfile: none CApath: /etc/ssl/certs * SSLv3, TLS handshake, Client hello (1): * error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol * Closing connection #0 curl: (35) error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
当通常情况下,当端口443上有其他东西在监听时,您通常会获得SSL23_GET_SERVER_HELLO 。在大多数情况下,当HTTPD在没有SSL的端口443上侦听时,会发生这种情况,但这次不是这种情况,因为您从http://steampj.com:443获取ERR_INVALID_HTTP_RESPONSE / ,并作为netcat显示:
nc -v steampj.com 443 DNS fwd/rev mismatch: steampj.com != li1097-44.members.linode.com steampj.com [213.219.38.44] 443 (https) open GET / HTTP/1.1 ▒▒▒PuTTY
因为你的nginx正在基于lsof -OnP | grep LISTEN监听端口443 lsof -OnP | grep LISTEN这个问题很可能是在Nginxconfiguration中。
检查是否有其他server {}部分不必要地listen 443并将其删除。 另外,我有CApath: /etc/ssl/certs而不是configuration/home/admin/conf/web/build议相同。
检查你确实有ipv6only=on 。 你有:
server { listen 443 ssl; listen [::]:443 ssl;
根据Nginx的指令 ngx_http_core_module文件listen :
ipv6only = ON | OFF
此参数(0.7.42)决定(通过
IPV6_V6ONLY套接字选项)侦听通配符地址[::]的IPv6套接字是只接受IPv6连接,还是只接受IPv6和IPv4连接。 该参数默认打开。 它只能在启动时设置一次。
尽pipe默认情况下这个选项应该是on ,你应该看看它是否在configuration的某个地方出现,并更新你的server {部分有:
server { listen 443 ssl; listen [::]:443 ipv6only=on ssl;
由于此参数只能在启动时设置一次,因此在default_serverconfiguration上启用它是非常重要的,因为这也会影响所有其他server 。
好吧,这不是一个真正的“答案”,但我已经设法得到它的工作。
我从头开始,并从头开始重新安装VestaCP :
curl -O http://vestacp.com/pub/vst-install.sh bash vst-install.sh --nginx yes --apache yes --phpfpm no --named no --remi yes --vsftpd yes --proftpd no --iptables yes --fail2ban yes --quota no --exim yes --dovecot yes --spamassassin yes --clamav yes --mysql yes --postgresql no --hostname com.mysite.com --email [email protected] --password xxx
然后我编辑/usr/local/vesta/data/templates/web/nginx/default.tpl,所以它也有:
listen [%ip%]:%proxy_port% ssl;
(由于某种原因,它只有IPv4,不知道为什么)。
然后我进入并设置域名,瞧 – 它的工作!