错误: 2014/11/28 01:02:16 [错误] 2501#0:* 4上游过早关闭连接,同时从上游读取响应头,客户端:75.64.105.189,服务器:xxx.yyy.com.au,请求:“GET / HTTP / 1.1“,上游:”uwsgi://127.0.0.1:8080“,主持人:”xxx.yyy.com.au“
使用以下
在虚拟环境中调用uwsgicd /home/ec2-user/prod_demo && /home/ec2-user/venv/bin/uwsgi --socket :8080 --wsgi-file /home/ec2-user/prod_demo/manage.py --callable app --processes 4 --threads 2 --stats :18080 --protocol=http &
Nginx配置
/etc/nginx/nginx.conf
user ec2-user;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 80;
server_name xxx.yyy.com.au *.xxx.yyy.com.au;
access_log /var/log/prod_demo/access_log;
root /home/ec2-user/prod_demo;
location / {
uwsgi_pass 127.0.0.1:8080;
include uwsgi_params;
}
location /static {
alias /home/ec2-user/prod_demo/app/static;
}
location = /favicon.ico {
alias /home/ec2-user/prod_demo/app/static/images/favicon.ico;
}
}
}
答案 0 :(得分:0)
现在似乎正在工作
uwsgi.ini
[uwsgi]
socket = :8080
chdir = /home/ec2-user/prod_demo
master = True
venv = /home/ec2-user/venv
callable = app
wsgi-file = /home/ec2-user/prod_demo/manage.py
enable-threads = True
在shell / upstart中调用uwsgi.ini(希望如此)
/home/ec2-user/venv/bin/uwsgi --ini uwsgi.ini