Node.js Nginx LetsEncrypt Bad Gateway

时间:2016-02-27 14:29:12

标签: node.js ssl express nginx lets-encrypt

我正在使用nginx和LetsEncrypt设置Node.js应用。

我进行了设置,但每次尝试访问时,都会出现502 Bad Gateway错误。

Node.js没有显示任何内容,所以我认为它甚至没有访问应用程序,检查了nginx日志并播下了这个......

ValueError: malformed node or string: <_ast.Call object at 0x7fe3eae74240>

nginx config:

2016/02/27 09:12:11 [error] 15706#0: OCSP_basic_verify() failed (SSL: error:27069076:OCSP routines:OCSP_basic_verify:signer certificate not found) while requesting certificate status, responder: ocsp.int-x1.letsencrypt.org
2016/02/27 09:12:11 [error] 15706#0: *1 upstream prematurely closed connection while reading response header from upstream, client: 212.121.109.65, server: gamepit.nl, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "gamepit.nl"
2016/02/27 09:12:11 [error] 15706#0: *1 upstream prematurely closed connection while reading response header from upstream, client: 212.121.109.65, server: gamepit.nl, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "gamepit.nl"
2016/02/27 09:12:11 [error] 15706#0: *1 upstream prematurely closed connection while reading response header from upstream, client: 212.121.109.65, server: gamepit.nl, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "gamepit.nl"
2016/02/27 09:12:11 [error] 15706#0: *1 upstream prematurely closed connection while reading response header from upstream, client: 212.121.109.65, server: gamepit.nl, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "gamepit.nl"

Node.js应用程序(非常小,因为我正在测试......)

upstream app_gamepit {
        server 127.0.0.1:3000;
}

# the nginx server instance
server {
    listen 443 ssl;
    server_name gamepit.nl;
    access_log /var/log/nginx/gamepit.log;

    ssl on;
    gzip on;

    ssl_certificate /etc/letsencrypt/live/gamepit.nl/cert.pem;
    ssl_certificate_key /etc/letsencrypt/live/gamepit.nl/privkey.pem;

    ssl_stapling on;
    ssl_stapling_verify on;
    ssl_trusted_certificate /etc/letsencrypt/live/gamepit.nl/fullchain.pem;

    # pass the request to the node.js server with the correct headers
    # and much more can be added, see nginx config options
    location / {
      proxy_pass https://app_gamepit/;
      proxy_redirect off;
    }
}

server {
    listen 443;
    server_name www.gamepit.nl;
    rewrite ^/(.*) https://gamepit.nl/$1 permanent;
}

1 个答案:

答案 0 :(得分:1)

我发现了问题...... github

存在问题

而不是

ssl_certificate /etc/letsencrypt/live/domain.com/cert.pem;

你应该使用

ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem;

我不明白为什么,但它现在有效。