我正在Jenkins后面运行Jenkins,并使用Let's Encrypt来获得SSL证书。 如果我通过https://jenkins.mydomain.de/访问该网站,一切工作正常。 但是,当我通过http://jenkins.mydomain.de/访问它,Firefox说:“连接被重置。”和curl说:“从服务器的空回复”
我如何debugging? 我真的不知道该在哪里寻找问题。 nginx日志不包含任何关于它的事情。 我怀疑在下面的configuration中关于端口80的部分是由其他指令无效,但我不知道我将如何调查。
$ curl -svL http://jenkins.mydomain.de/ * Hostname was NOT found in DNS cache * Trying my.ip.add.ress... * Connected to jenkins.mydomain.de (my.ip.add.ress) port 80 (#0) > GET / HTTP/1.1 > User-Agent: curl/7.38.0 > Host: jenkins.mydomain.de > Accept: */* > * Empty reply from server * Connection #0 to host jenkins.mydomain.de left intact
当使用telnet与服务器通话时,一旦我只返回一次(即在GET / HTTP/1.1 ),连接就会closures。
即使Firefox没有SSL证书的问题,curl也会这样做:
$ curl -svL https://jenkins.mydomain.de/ * Hostname was NOT found in DNS cache * Trying my.ip.add.ress... * Connected to jenkins.mydomain.de (my.ip.add.ress) port 443 (#0) * successfully set certificate verify locations: * CAfile: none CApath: /etc/ssl/certs * SSLv3, TLS handshake, Client hello (1): } [data not shown] * SSLv3, TLS handshake, Server hello (2): { [data not shown] * SSLv3, TLS handshake, CERT (11): { [data not shown] * SSLv3, TLS alert, Server hello (2): } [data not shown] * SSL certificate problem: unable to get local issuer certificate * Closing connection 0 * SSLv3, TLS alert, Client hello (1): } [data not shown]
我的Nginxconfiguration:
upstream jenkins { server localhost:8080 fail_timeout=0; } server { listen 80 default; server_name jenkins.mydomain.de; return 301 https://$server_name$request_uri; # Replacing $server_name with $host does not work either. } server { listen 443 default ssl; server_name jenkins.mydomain.de; ssl on; ssl_certificate /etc/letsencrypt/live/jenkins.mydomain.de/cert.pem; ssl_certificate_key /etc/letsencrypt/live/jenkins.mydomain.de/privkey.pem; ssl_ciphers HIGH:!ADH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4; ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; ssl_session_timeout 5m; ssl_session_cache builtin:1000 shared:SSL:10m; location / { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_redirect http://localhost:8080 https://$server_name; proxy_pass https://jenkins; } }
Nginx正在监听端口80:
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3895/nginx tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1048/sshd tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 3895/nginx tcp6 0 0 :::41117 :::* LISTEN 19911/java tcp6 0 0 :::8080 :::* LISTEN 19911/java tcp6 0 0 :::22 :::* LISTEN 1048/sshd tcp6 0 0 :::49208 :::* LISTEN 19911/java