[英]NGINX with uwsgi and django connection refused
Welcome stackoverflowers. 欢迎stackoverflowers。 I`ve been fighting with setting up nginx with uwsgi with django app... There has to be a small mistake somewhere but I cant find it.
我一直在与使用django应用程序的uwsgi设置nginx ...在某处有一个小错误,但我找不到它。 Here is my file from pastebin, containing files directly related to my issue and also a console log.
这是来自pastebin的文件,包含与我的问题直接相关的文件以及控制台日志。 I would be very greateful if somebody could take a look and help me out.
如果有人可以看看并帮助我,我会非常感激。
artcolor_uwsgi.ini file 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 file 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 file 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()
my console 我的控制台
(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)
SOLVED I linked my nginx file to sites-available not as I was supossed to sites-enabled 已解决我将我的nginx文件链接到网站 - 不是因为我被置于已启用网站
SOLUTION: 解:
I managed to resolve problem. 我设法解决了问题。
The reason was wrong linking the nginx.conf file. 原因是链接nginx.conf文件时出错了。
I accidently linked in to sites-available
, not as I was supposed to sites-enabled
我意外地链接到
sites-available
,而不是我应该sites-enabled
Thanks 谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.