我的目标是从端口80重定向到443 (强制https),但无法首先获得有效的https配置。我收到503服务器错误,并且日志中没有任何内容。我看过SO和SF上的所有帖子,没有一个有效(X_FORWARDED_PROTO,X-Forwarded-For headers没有区别)。我在负载均衡器后面的EC2上,所以我不需要使用与SSL相关的指令,因为我已经在ELB上配置了我的证书。我正在使用Tornado作为web服务器。
这是配置,如果有人有想法,谢谢!
http {
# Tornado server
upstream frontends {
server 127.0.0.1:8002;
}
server {
listen 443;
client_max_body_size 50M;
root <redacted>/static;
location ^~/static/ {
root <redacted>/current;
if ($query_string) {
expires max;
}
}
location / {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://frontends;
}
}
}发布于 2012-11-27 18:07:30
嗯,有两个不同的任务:
如果您需要将所有http流量重定向到https,则需要在nginx中创建http服务器:
server {
listen 80;
server_name example.com;
return 301 https://example.com$request_uri;
}第二个注意,如果你的SSL是在ELB终止的,那么你根本不需要支持ssl的nginx服务器。只需将流量从ELB传递到您的服务器80端口。
https://stackoverflow.com/questions/13576319
复制相似问题