我正在尝试在新服务器上配置我的django应用程序。它工作正常,除非我尝试传递GET参数。我收到以下错误。
uWSGI:
[pid: 21530|app: 0|req: 8/9] 109.68.173.7 () {42 vars in 880 bytes} [Thu Mar 2 17:19:29 2017] GET /install/?token=123&shop=1234&insales_id=124 => generated 0 bytes in 71 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)
nginx的:
2017/03/02 09:19:29 [error] 21644#0: *1 upstream prematurely closed connection while reading response header from upstream, client: 109.68.173.7, server: 151-248-112-157.xen.vps.regruhosting.ru, request: "GET /install/?token=123&shop=1234&insales_id=124 HTTP/1.1", upstream: "uwsgi://unix:/home/trackpost.sock:", host: "151-248-112-157.xen.vps.regruhosting.ru"
我的配置文件。的 nginx.conf:
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
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;
tcp_nodelay on;
keepalive_timeout 120;
client_max_body_size 20M;
uwsgi_read_timeout 86400;
uwsgi_send_timeout 86400;
proxy_buffers 8 32k;
proxy_buffer_size 64k;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# 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 151-248-112-157.xen.vps.regruhosting.ru;
location = favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/rajansnow/django/trackpost;
}
location / {
include uwsgi_params;
uwsgi_pass unix:/home/trackpost.sock;
}
}
}
app.ini(uwsgi):
[uwsgi]
project = trackpost
username = rajansnow
base = /home/%(username)/django
chdir = %(base)/%(project)
home = %(base)/venv
module = %(project).wsgi:application
plugin = python
master = true
processes = 5
uid = rajansnow
socket = /home/trackpost.sock
chown-socket = rajansnow:nginx
chmod-socket = 666
vacuum = true
touch-reload = /home/rajansnow/django/trackpost/uwsgi.ini
py-autoreload = 3
harakiri = 30
我的代码有点糟糕,我知道。但它在我以前的服务器上工作,这是基于Debian的。目前是基于CentOS的。我已经尝试过在SO上找到的所有东西,但没有运气。我该怎么做才能解决这个问题?
答案 0 :(得分:0)
现在是神秘的时候了,孩子们!
通过对每个项目文件进行硬核检查,解决了问题中提到的问题。事实证明,其中一些包含意外的符号,这些符号曾经使Django抛出编码错误,结果使uwsgi停止。
神秘的部分是文件在问题发生前很长一段时间内被修改过。那么它们如何包含额外的符号呢?没人知道。
至少现在,我们可以说它已经解决了。