django登台服务器(EC2)上的curl重定向到localhost

时间:2014-12-02 13:12:42

标签: python django nginx amazon-ec2 gunicorn

命令 -

curl -I http://stage.servername.com/

回应 -

HTTP/1.1 301 MOVED PERMANENTLY
Server: nginx/1.4.6 (Ubuntu)
Date: Tue, 02 Dec 2014 13:18:45 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
x-frame-options: DENY
Location: https://127.0.0.1:8000/
x-content-type-options: nosniff
P3P: CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"

以下是我的nginx设置 - https://gist.github.com/anonymous/f84c5b7bed41b40a3cfd

gunicorn服务器正在8000端口运行。

(bz)username@ip-172-31-4-167:~$ ps aux|grep gunicorn
username    2283  0.0  0.5  51912 11028 ?        S    11:42   0:00 /home/username/Envs/bz/bin/python /home/username/Envs/bz/bin/gunicorn bizchat.wsgi:application --workers=3 -D
username    2288  0.0  1.3 136244 28428 ?        S    11:42   0:00 /home/username/Envs/bz/bin/python /home/username/Envs/bz/bin/gunicorn bizchat.wsgi:application --workers=3 -D
username    2289  0.0  1.3 136260 28428 ?        S    11:42   0:00 /home/username/Envs/bz/bin/python /home/username/Envs/bz/bin/gunicorn bizchat.wsgi:application --workers=3 -D
username    2290  0.0  1.7 144484 36860 ?        S    11:42   0:00 /home/username/Envs/bz/bin/python /home/username/Envs/bz/bin/gunicorn bizchat.wsgi:application --workers=3 -D
username    3452  0.0  0.0  10468   924 pts/0    S+   13:09   0:00 grep --color=auto gunicorn

nginx服务还可以。

但我使用django-secure但使用以下标记SSLIFY_DISABLE=True

当我打开 url.myapp.com redirectshttps://127.0.0.1:8000

任何想法,出了什么问题?

1 个答案:

答案 0 :(得分:0)

如果你没有它,请将它放在你的nginx.conf中:

proxy_set_header Host $host;