带有 uwsgi 和 django 连接的 NGINX 被拒绝

NGINX with uwsgi and django connection refused

欢迎 Whosebugers。我一直在为使用 uwsgi 和 django 应用程序设置 nginx 而苦苦挣扎......某处一定有一个小错误,但我找不到它。这是我来自 pastebin 的文件,其中包含与我的问题直接相关的文件以及控制台日志。如果有人能帮我看看,我将不胜感激。

artcolor_uwsgi.ini 文件

[uwsgi]

chdir           = /home/seb/pypassion/artcolor/src/
module          = artcolor.wsgi
home            = /home/seb/pypassion/artcolor/artcolor_venv/

master          = true
processes       = 10
socket          = /home/seb/pypassion/artcolor/src/artcolor.sock
#http-socket = :8001

#vacuum          = true

artcolor_nginx.conf 文件

upstream django {
    server /home/seb/pypassion/artcolor/src/artcolor.sock; # for a file socket
    #server 127.0.0.1:8001;
}

# configuration of the server
server {
    # the port your site will be served on
    listen      8001;
    server_name localhost; # substitute your machine's IP address or FQDN
    charset     utf-8;

    access_log /home/seb/pypassion/artcolor/logs/nginx-access.log;
    error_log /home/seb/pypassion/artcolor/logs/nginx-error.log;


    # max upload size
    client_max_body_size 1G;   # adjust to taste

    # Django media
    location /media/  {
        alias /home/seb/pypassion/artcolor/src/media/;  # your Django project's media files - amend as required
    }

    location /static/ {
        alias /home/seb/pypassion/artcolor/src/static/; # your Django project's static files - amend as required
    }

    # Finally, send all non-media requests to the Django server.
    location / {
        uwsgi_pass  django;
        include    uwsgi_params; # the uwsgi_params file you installed
    }
}

wsgi.py 文件

import os
import sys

sys.path.append("/home/seb/pypassion/artcolor/src/")
sys.path.append("/home/seb/pypassion/artcolor/src/artcolor/")

sys.path = sys.path[::-1]

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "artcolor.settings")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

我的主机

(artcolor_venv)seb@debian:~/pypassion/artcolor/src$ uwsgi --ini artcolor_uwsgi.ini
[uWSGI] getting INI configuration from artcolor_uwsgi.ini
*** Starting uWSGI 2.0.9 (64bit) on [Fri Feb 27 11:48:45 2015] ***
compiled with version: 4.7.2 on 27 February 2015 11:00:34
os: Linux-3.2.0-4-amd64 #1 SMP Debian 3.2.65-1+deb7u2
nodename: debian
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 8
current working directory: /home/seb/pypassion/artcolor/src
detected binary path: /home/seb/pypassion/artcolor/artcolor_venv/bin/uwsgi
chdir() to /home/seb/pypassion/artcolor/src/
your processes number limit is 63796
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 /home/seb/pypassion/artcolor/src/artcolor.sock fd 3
Python version: 2.7.3 (default, Mar 13 2014, 11:26:58)  [GCC 4.7.2]
Set PythonHome to /home/seb/pypassion/artcolor/artcolor_venv/
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x20e9d30
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 800448 bytes (781 KB) for 10 cores
*** Operational MODE: preforking ***
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x20e9d30 pid: 14848 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 14848)
spawned uWSGI worker 1 (pid: 14849, cores: 1)
spawned uWSGI worker 2 (pid: 14850, cores: 1)
spawned uWSGI worker 3 (pid: 14851, cores: 1)
spawned uWSGI worker 4 (pid: 14852, cores: 1)
spawned uWSGI worker 5 (pid: 14853, cores: 1)
spawned uWSGI worker 6 (pid: 14854, cores: 1)
spawned uWSGI worker 7 (pid: 14855, cores: 1)
spawned uWSGI worker 8 (pid: 14856, cores: 1)
spawned uWSGI worker 9 (pid: 14857, cores: 1)
spawned uWSGI worker 10 (pid: 14858, cores: 1)

已解决 我将我的 nginx 文件链接到 sites-available,而不是因为我被 supossed 到 sites-enabled

解决方案:

我设法解决了问题。

链接 nginx.conf 文件的原因是错误的。

我不小心链接到了 sites-available,而不是我应该的 sites-enabled

谢谢