簡體   English   中英

我是否必須在 AWS Application Load Balancer 后面的 nginx.conf 文件中配置 SSL 證書文件?

[英]Do I have to configure SSL certificates files in nginx.conf file behind AWS Application Load Balancer?

我在 AWS EC2 中有一個用於 HTTPS 傳入連接的配置。 由於我是這個東西的新手,我有 nginx 配置,我會以一種老式的方式進行編輯: https://nginx.org/en/docs/http/configuring_https_servers.html

不過,在 AWS EC2 中,我可以向其添加證書,然后將 443 和 80 端口連接重定向到,例如,我的 nginx 作為反向代理運行的端口 8000。

nginx 是否仍然必須在本地擁有這些證書文件並將它們的路徑添加到配置中,還是應該由 ELB 解碼流量並發送到 nginx 解碼?

如果在 ELB 中設置並分配給 HTTPS 偵聽器,則您不必在 EC2 上使用 nginx 擁有 SSL 證書。 只需確保您的 EC2 的目標組是端口 8000 的 HTTP 類型。

如前所述,應在 ALB 端設置證書。
Nginx 作為 AWS ALB 背后的反向代理的這種配置對我有用:

server {    
    listen       80;
    listen       443;
    server_name  server_name;


    location / {
                proxy_pass         http://localhost:8000;
                proxy_set_header   Host                 $host;
                proxy_set_header   X-Forwarded-HTTPS    on;
                proxy_set_header   X-Real-IP            $remote_addr;
                proxy_set_header   X-Forwarded-For      $proxy_add_x_forwarded_for;
                proxy_redirect off;        
    }

暫無
暫無

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

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