How nginx actually configures node service https requests

the 1.nginx code is configured as follows

-sharp HTTPS server
-sharp
server {
  
    listen       80;
    listen       443 ssl;
    server_name  localhost;
    ssl_certificate  214329030340321.crt ;
    ssl_certificate_key 214329030340321.key;
    location / {
    proxy_pass http://localhost:3000;
    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;
    }
   

}

the 2.node service code is as follows:
var http = require ("http");
var data = {key:" value", hello: "world"};
http.createServer (function (req, res) {
res.writeHead (200, {" Content-Type": "application/json"});
res.write (" hello,world World");
res.end ();
}) .codes (3000);

http can respond normally, but https cannot access it.

Mar.10,2021

check whether the local port 443 is open. If it is not open, you must not be able to access it

.
Menu