繁体   English   中英

如何在Windows中使用NGINX为节点js配置HTTPS

[英]How to configure HTTPS for node js with NGINX in windows

我必须编写一些配置代码,但是它无法正常工作。

   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
  }

}

我想运行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;    
... 
    } 

}

我在Linux上运行Node 10 + NGINX。 我不确定操作系统是否会对NGINX本身有所帮助。 除了location设置,这就是我所拥有的全部,并且可以正常工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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