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

问题描述 投票:1回答:1

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

   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

node.js windows nginx https
1个回答
0
投票
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设置,它的工作原理。

© www.soinside.com 2019 - 2024. All rights reserved.