简体   繁体   中英

How to configure HTTPS for node js with NGINX in windows

I have to write some of configuration code but it does not work.So what i do for fix this issue

   server {
  listen       3000;
  listen       443 ssl;
  server_name  localhost;

        ssl_certificate  /nginx-1.15.12/ssl/server.crt; // own certificate
        ssl_certificate_key /nginx-1.15.12/ssl/server.key; //own privatekey
        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;

        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;

  location / {
    proxy_pass https://10.0.0.4:3000;  //my local IP with node js running port number
    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;
  }

  location /public {
    root C:\Program-Files\iisnode\www\RSRK_BETA; // path of my node js application
  }

}

I want to Run HTTPS

server {
    listen 443 ssl;   
    server_name localhost;
    ssl_certificate     /path/to/cert-storage/cert-self-signed.com.crt;
    ssl_certificate_key /path/to/cert-storage/cert-self-signed.com.key;    
... 
    } 

}

I am running Node 10 + NGINX, on Linux. I am not sure that operating system should make a difference for NGINX itself. This is all I have, besides location settings, and it works.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM