大网数据广告活动
服务器运维问答

Let's Encrypt certificate not recognized by Nginx

· 52CE 我爱测

I successfully created some LE SSL certs, using this guide . However, when I updated my nginx config to use the certs and redirect all port 80 traffic to 443. http successfully redirects to https, the site doesn't load. The brows…

问题原文

原帖链接 · huertanix · CC BY-SA 3.0

I successfully created some LE SSL certs, using this guide.

However, when I updated my nginx config to use the certs and redirect all port 80 traffic to 443. http successfully redirects to https, the site doesn't load. The browser detects that I have a valid cert, but says I do not have a secure connection. This is what I have in my /var/log/nginx/error.log:

2016/03/08 00:11:49 [error] 7301#0: *14 no "ssl_certificate" is defined in server listening on SSL port while SSL handshaking, client: 55.555.55.555, server: 0.0.0.0:443

The error says I have no SSL cert defined, despite the fact that I do. This is my config:

server {
  listen 443 ssl;
  server_name cooldomain.pizza www.cooldomain.pizza
  ssl_certificate /etc/letsencrypt/live/cooldomain.pizza/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/cooldomain.pizza/privkey.pem;

  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_prefer_server_ciphers on;
  ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';

  root /home/ubuntu/www/cooldomain-pizza;
  index index.php index.html index.htm;

  server_name cooldomain.pizza www.cooldomain.pizza;
  charset utf-8;

  location / {
    try_files $uri $uri/ =404;
    # Uncomment to enable naxsi on this location
    # include /etc/nginx/naxsi.rules
  }

  location ~ \.php$ {
    try_files $uri $uri/ =404;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
  }
}

I'm running Ubuntu 14.04 with Nginx 1.4.6.

Any idea what is happening? I had to roll back the SSL version of the site and go back to being port-80-only.

已采纳解答

原帖链接 · Peter Green · CC BY-SA 3.0

You appear to be missing a semicolon at the end of the server_name directive. I suspect this is causing the following line to be interpreted as part of the server_name directive rather than as a new directive.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-03-08)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。