我想将TLS添加到我的AWS Elastic Beanstalk应用程序。这是一个在nginx代理服务器后面运行的node.js应用。
这是我已完成的步骤
我的nginx配置的相关部分是
files:
/etc/nginx/conf.d/proxy.conf:
mode: "000644"
content: |
upstream nodejs {
server 127.0.0.1:8081;
keepalive 256;
}
server {
listen 8080;
proxy_set_header X-Forwarded-Proto $scheme;
if ( $http_x_forwarded_proto != 'https' ) {
return 301 https://$host$request_uri;
}
location / {
proxy_pass http://nodejs;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
当我尝试使用https访问我的应用程序时,我得到一个408: Request Timed Out
。
据我了解,要在nginx上启用ssl,我们需要将cert和pem文件一起添加并监听端口443。但是由于我使用的是ACM证书,所以我没有cert和pem文件。 / p>
要使此功能有效,我需要在nginx.conf中添加些什么?
谢谢
答案 0 :(得分:1)
在负载平衡器侦听器配置中,对于端口443
的侦听器,“实例端口”设置应为80
。