I have this config for NGINX:
server {
listen 80;
listen 443 ssl;
server_name rahim27.fr;
ssl_certificate /etc/letsencrypt/live/rahim27.fr/cert.pem;
ssl_certificate_key /etc/letsencrypt/live/rahim27.fr/privkey.pem;
error_log logs/error.log warn;
location / {
proxy_pass http://localhost:8080;
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;
}
}
And this basic NodeJS server :
const http = require('http');
http.createServer(function (req, res) {
res.writeHead(200);
res.end("hello world\n");
}).listen(8080);
When I go to http://rahim27.fr/ , I get my hello world
but if I try https://rahim27.fr/ I get ERR_CONNECTION_RESET
, with curl it gives me curl: (7) Failed to connect to rahim27.fr port 443: No route to host
from Linux (the VM) and curl: (35) schannel: failed to receive handshake, SSL/TLS connection failed
from Windows.
The server is in a cloud VM, I opened up all ports in the cloud dashboard and in the VM itself.
The SSL certificate was generated by certbot automatically.
What I want :
hello world
What I tried :
The easiest way would be to remove the ssl_certificate and ssl_certificate_key lines and use certbot which takes care of automatically managing the https.
I invite you to follow the following easy-to-follow instructions:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.