django + uwsgi + nginx没有提供任何http响应,什么也没说

时间:2015-11-03 15:23:52

标签: django nginx

系统似乎正在运行,但我没有得到任何正常的HTTP响应:

Romans-MacBook-Pro:kariera-centr.ru rreimche$ telnet yozh-studio.com 80
Trying 46.101.236.181...
Connected to yozh-studio.com.
Escape character is '^]'.
GET / HTTP/1.1
Host: yozh-studio.com

Connection closed by foreign host.
Romans-MacBook-Pro:kariera-centr.ru rreimche$ telnet yozh-studio.com 80
Trying 46.101.236.181...
Connected to yozh-studio.com.
Escape character is '^]'.
GET / HTTP/1.1
Host: yozh-studio.com
Accept: text/html,application/xhtml+xml,application/xml;
        q=0.9,*/*;q=0.8

Connection closed by foreign host.

uwsgi.log保持与启动服务后一样:

[rreimche@rreimche-web hedgehog]$ sudo cat log/uwsgi.log 
[sudo] password for rreimche: 
*** Starting uWSGI 2.0.11.2 (64bit) on [Tue Nov  3 15:57:03 2015] ***
compiled with version: 4.8.3 20140911 (Red Hat 4.8.3-9) on 29 October 2015 19:27:56
os: Linux-3.10.0-123.8.1.el7.x86_64 #1 SMP Mon Sep 22 19:06:58 UTC 2014
nodename: rreimche-web
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 1
current working directory: /etc/uwsgi/sites
detected binary path: /usr/bin/uwsgi
chdir() to /var/www/hedgehog/code
your processes number limit is 7870
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to UNIX address /run/uwsgi/hedgehog.sock fd 3
setuid() to 1003
Python version: 2.7.5 (default, Jun 24 2015, 00:41:19)  [GCC 4.8.3 20140911 (Red Hat 4.8.3-9)]
Set PythonHome to /home/hedgehog/.virtualenv/hedgehog
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x25c8c10
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 436608 bytes (426 KB) for 5 cores
*** Operational MODE: preforking ***
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x25c8c10 pid: 2938 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 2938)
spawned uWSGI worker 1 (pid: 2943, cores: 1)
spawned uWSGI worker 2 (pid: 2944, cores: 1)
spawned uWSGI worker 3 (pid: 2945, cores: 1)
spawned uWSGI worker 4 (pid: 2946, cores: 1)
spawned uWSGI worker 5 (pid: 2947, cores: 1)

nginx日志为空:

[rreimche@rreimche-web hedgehog]$ sudo cat log/access.log 
[rreimche@rreimche-web hedgehog]$ sudo cat log/error.log 
[rreimche@rreimche-web hedgehog]$ 

配置(CentOS 7):

/etc/uwsgi/sites/hedgehog.ini:

[uwsgi]
project = hedgehog
username = hedgehog
base = /var/www/%(username)/code

chdir = /var/www/hedgehog/code
home = /%(username)/.virtualenv/%(username)
module = %(username).wsgi:application

master = true
processes = 5

uid = %(username)
socket = /run/uwsgi/%(project).sock
chown-socket = %(username):nginx
chmod-socket = 660
vacuum = true
logto = /var/www/%(username)/log/uwsgi.log

/etc/systemd/system/uwsgi.service:

[Unit]
Description=uWSGI Emperor service

[Service]
ExecStartPre=/usr/bin/bash -c 'mkdir -p /run/uwsgi; chown hedgehog:nginx/run/uwsgi'
ExecStart=/usr/bin/uwsgi --emperor /etc/uwsgi/sites
Restart=always
KillSignal=SIGQUIT
Type=notify
NotifyAccess=all

[Install]
WantedBy=multi-user.target

/etc/nginx/conf.d/hedgehog.conf:

server {
    listen 80;
    server_name yozh-studio.com, www.yozh-studio.com;

    access_log /var/www/hedgehog/log/access.log;
    error_log /var/www/hedgehog/log/error.log;

    location = favicaon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /var/www/hedgehog/static;
    }

    location / {
        include uwsgi_params;
        uwsgi_pass unix:/run/uwsgi/hedgehog.sock;
    }
}

0 个答案:

没有答案