簡體   English   中英

nginx代理傳遞節點,SSL?

[英]nginx proxy pass Node, SSL?

我的nginx服務器實際上是用一個簡單的代理我的節點后端(它在端口3000上偵聽):

location /api/ {
proxy_pass http://upstream_1;
}

其中upstream_1是我在nginx.conf中定義的節點集群(在端口3000上)。

我將不得不通過http連接添加SSL,所以我有以下問題:我是否只需要配置nginx來啟用ssl? 它會自動“解密”請求並將其解密傳遞給Node,它將能夠正常處理它嗎? 或者我是否還需要配置Nodej以支持ssl?

如果您使用nginx來處理SSL,那么您的節點服務器將只使用http。

    upstream nodejs { 
          server 127.0.0.1:4545 max_fails=0; 
    } 

   server { 
      listen 443; 
      ssl    on; 
      ssl_certificate    newlocalhost.crt; 
      ssl_certificate_key     newlocalhost.key; 
      server_name nodejs.newlocalhost.com; 

      add_header Strict-Transport-Security max-age=500; 

      location / { 
        proxy_pass  http://nodejs; 
        proxy_redirect off; 
        proxy_set_header Host $host ; 
        proxy_set_header X-Real-IP $remote_addr ; 
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ; 
        proxy_set_header X-Forwarded-Proto https; 
      } 
   }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM