我已经设置了我的express和node应用程序来使用我的letsencrypt ssl证书

var options = {
    key: fs.readFileSync('/etc/letsencrypt/live/example.com/privkey.pem'),
    cert: fs.readFileSync('/etc/letsencrypt/live/example.com/cert.pem')
};

// Create an HTTP service.
http.createServer(app).listen(3060);
// Create an HTTPS service identical to the HTTP service.
https.createServer(options, app).listen(3061);

我可以在domain.com上访问我的API(在nginx中访问端口80)

但如果我点击https://example.com(443号港口)我无法达到

但是,如果我打开端口3061并请求https://example.com:3061并且它可以正常使用SSL,我就可以访问它

My question is, how do I setup nginx to correctly forward requests on port 443 to my server on port 3061 for SSL.

如果我的应用正在处理它,我是否需要按照其他地方的建议包含证书信息?

我的nginx配置是这样的:

server {
    listen 80;
    server_name example.com;

    location / {
        proxy_pass http://localhost:3060;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}   

server {
    listen 443 ssl;
    server_name example.com;

    location / {
        proxy_pass https://localhost:3061;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

谢谢