我有一个运行nginx,django 1.5,gunicorn的应用程序。
场景1 当我加载我的应用程序一次时 - 它将显示具有基础200 HTTP响应的页面文件。
场景2
但是,如果我重新加载此页面后,它会显示我的HTTP 500默认值,但会显示自定义页面。
场景X 如果我再次重新加载,它将在后续页面重新加载时显示场景1或场景2。
我查看了我的access.log以获取nginx和...
显示500错误页面的信息:
[05/Oct/2013:03:26:07 +0000] "GET / HTTP/1.1" 500 460 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0"
[05/Oct/2013:03:21:19 +0000] "GET /static/img/templated/base/subnav_back.png HTTP/1.1" 304 0 "http://mydomain.com/static/css/base.css" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0"
它显示了200 HTTP响应的信息:
[05/Oct/2013:03:18:25 +0000] "GET /static/img/templated/base/subnav_back.png HTTP/1.1" 200 7674 "http://mydomain.com/static/css/mysite_base.css" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0"
nginx conf看起来像:
server {
server_name ec2-X-X-X-X.compute-1.amazonaws.com;
access_log /home/ubuntu/virtualenv/mysite/error/access.log;
error_log /home/ubuntu/virtualenv/mysite/error/error.log warn;
connection_pool_size 2048;
root /home/ubuntu/virtualenv/mysite/homelaunch/;
location /static/ {
alias /home/ubuntu/virtualenv/mysite/homelaunch/static/;
#alias /static/;
#root /home/ubuntu/virtualenv/mysite/homelaunch/;
}
location / {
proxy_pass http://127.0.0.1:8001;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_set_header X-Forwarded-Host $server_name;
#proxy_set_header X-Real-IP $remote_addr;
add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
}
}
error.log有:
2013/09/21 19:36:22 [error] 12680#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: XX.XXX.XX.XXX, server: ec2-x-x-x-x.compute-1.amazonaws.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8001/", host: "www.mysite.com", referrer: "http://www.mysite.com/dir/"