node.js - 如何在windows中使用NGINX为node js配置HTTPS

标签 node.js windows nginx https

我必须编写一些配置代码,但它不起作用。那么我要做什么来解决这个问题

   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 本身产生影响。除了位置设置之外,这就是我所拥有的一切,并且它有效。

关于node.js - 如何在windows中使用NGINX为node js配置HTTPS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55881104/

相关文章:

node.js - smtp通过postfix发送邮件和nodejs nodemailer连接关闭

javascript - Sails : JSON array of Model objects successfully created and displayed, 但只有一些保存到数据库

windows - 使用Electron时,MongoDb连接的初始化和查询非常慢

c - 如何为 Visual Studio 2005 安装 pthread_win32(Windows pthread/posix 线程库)?

ruby - 如何在 ruby​​ 中处理文件时同时运行多个线程?

amazon-web-services - AWS SNS 通知未使用 HTTPS 访问服务器

ssl - NGINX SSL 超时

node.js - nvm 和 node --version 不一致?

javascript - Node.js 捕获生成后引发的 ENOMEM 错误

php - 如果正在进行流式下载,Nginx PHP-FPM 不提供请求