【发布时间】:2017-08-21 18:17:37
【问题描述】:
我正在尝试将 http 重定向到 https,并且我有这个配置:
files:
"/etc/nginx/conf.d/robots.conf":
mode: "000544"
owner: root
group: root
content: |
server {
listen 80;
server_name example.com;
location =/health {
return 200 "health-check";
}
location / {
if ($http_x_forwarded_proto != "https") {
return 301 https://$host$request_uri;
}
}
}
server {
listen 80 default_server;
server_name www.example.com;
location =/health {
return 200 "health-check";
}
location / {
if ($http_x_forwarded_proto != "https") {
return 301 https://$host$request_uri;
}
}
}
但是当我转到http://example.com 或http://www.example.com 时,没有重定向... 我尝试了多种设置,但似乎始终无法完全发挥作用。
【问题讨论】:
标签: amazon-web-services nginx amazon-elastic-beanstalk