【发布时间】:2016-04-30 12:57:06
【问题描述】:
问题
当我点击kevinsuttle.com 时,我得到了
"No data received ERR_EMPTY_RESPONSE".
当我点击https://kevinsuttle.com 时,我得到了该网站。
幽灵 0.7.5
nginx 1.4 => 1.9.9
让我们加密 0.2.0
数字海洋:Ubuntu 14.04 Ghost 1-click droplet
在 Networking > Domains 下,我有 kevinsuttle.com 和 www.kevinsuttle.com 作为指向服务器 IP 地址 (@) 的 A 记录。
DNSimple 记录
|类型 |姓名 | TTL |内容 | |-------- |---------- |--------------- |---- -------------------- | |网址 | www.kevinsuttle.com | 3600 (1 小时) | http://kevinsuttle.com |Ghost 的 config.js 中唯一修改的部分是我的域。
url: 'http://kevinsuttle.com',
Nginx 1.9
nginx 1.9 默认不创建以下目录:
/etc/nginx/sites-available
/etc/nginx/sites-enabled
并且通常的default conf 不会在这两个目录中创建。
取而代之的是etc/nginx/conf.d/default.conf 和重要的etc/nginx/conf.d/nginx.conf。您会看到很多教程告诉您删除 default.conf,这似乎很好,但无论您做什么,不要删除 nginx.conf。
此外,您应该将ghost.conf 移动/创建到/etc/nginx/conf.d/ 目录中。这就是解决我的一个问题的原因,因为etc/nginx/conf.d/nginx.conf 中的最后一行在/conf.d/ 目录中查找并包含那里的所有文件:include /etc/nginx/conf.d/*.conf;
这是我的/etc/nginx/conf.d/ghost.conf 文件:
server {
root /usr/share/nginx/html;
index index.html index.htm;
listen 443 ssl http2;
server_name kevinsuttle.com www.kevinsuttle.com;
ssl_certificate /etc/letsencrypt/live/kevinsuttle.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/kevinsuttle.com/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
location ~ /.well-known {
allow all;
root /var/www/;
}
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header HOST $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:2368;
proxy_redirect off;
root /var/www/;
}
location /.well-known/ {
root /var/www/;
}
}
server {
listen 80 ssl http2;
server_name kevinsuttle.com;
return 301 https://$host$request_uri;
}
现在,我一切正常,并尝试将 nginx 升级到 1.9+,以便通过 http/2 服务。 DigitalOcean 的 1-click Ghost droplet 默认使用 nginx 1.4。
长话短说,我一直收到这个错误:
dpkg: error processing archive /var/cache/apt/archives/nginx_1.9.9-1~trusty_amd64.deb (--unpack):
我找到的唯一解决方案是
apt-get purge nginx nginx-common
然后我可以安装 nginx 1.9,方法是将以下几行添加到我的 /etc/apt/source.list 文件中。
deb http://nginx.org/packages/mainline/ubuntu/ trusty nginx
deb-src http://nginx.org/packages/mainline/ubuntu/ trusty nginx
现在我只是添加了listen 80 ssl http2; 和listen 443 ssl http2;,http/2 就可以正常工作了。但仅当显式输入 https:// URL 时。
我发现some evidence 表明express 不支持http/2,但我并不是100% 支持这一点。
任何想法将不胜感激。
【问题讨论】:
标签: nginx https http2 ghost lets-encrypt