uWSGI配置错误' core / socket.c' - 带Django& NGINX

时间:2016-07-08 05:01:38

标签: django ubuntu nginx uwsgi digital-ocean

我正在使用NGINX& amp ;;在Ubuntu 14.04(Digital Ocean Droplet)上设置Django站点。 uWSGI(遵循此tutorial w / out进行第二个项目)。我可以使用manage.py运行我的Django站点。我也可以毫无问题地运行uwsgi --http :8080 --home /home/andrew/Env/personalsitevenv --chdir /home/andrew/andrew-django-personal-site/personalsite -w personalsite.wsgi。我可以看到我的网站在我的IP:Port上运行。我也可以毫无问题地运行uwsgi --http :8000 --module personalsite.wsgi --virtualenv /home/andrew/Env/personalsitevenv

当我转到我服务器的IP时,我看到的只是Welcome to nginx!页面。没有任何NGINX日志错误& sudo service nginx configtest很干净。我收到的唯一信息是我为uWSGI设置的日志文件,其中包含:

*** Starting uWSGI 2.0.12 (64bit) on [Fri Jul  8 00:41:22 2016] ***
compiled with version: 4.8.4 on 05 July 2016 17:45:39
os: Linux-4.4.0-28-generic #47~14.04.1-Ubuntu SMP Fri Jun 24 16:30:35 UTC 2016
nodename: **********
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/local/bin/uwsgi
chdir() to /home/andrew/andrew-django-personal-site/personalsite
your processes number limit is 1832
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)
bind(): No such file or directory [core/socket.c line 230]

任何人都可以发现任何配置问题或其他可能错误的内容吗?

/etc/uwsgi/sites/personalsite.ini

[uwsgi]
logto = /var/log/uwsgi/log.txt

project = personalsite
base = /home/andrew
repo = andrew-django-personal-site

chdir = %(base)/%(repo)/%(project)
home = %(base)/Env/personalsitevenv
module = %(project).wsgi:application

master = true
processes = 5

socket = $(base)/%(repo)/%(project)/%(project).sock
chmod-socket = 664
chown-socket = www-data
vacuum = true

/etc/init/uwsgi.conf

description "uWSGI application server in Emperor mode"

start on runlevel [2345]
stop on runlevel [!2345]

setuid andrew
setgid www-data

exec /usr/local/bin/uwsgi --emperor /etc/uwsgi/sites

的/ etc / nginx的/位点可用/ personalsite

server {
    listen 80;

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /home/andrew/andrew-django-personal-site/personalsite;
    }

    location / {
        include         uwsgi_params;
        uwsgi_pass      unix:/home/andrew/andrew-django-personal-site/personalsite/personalsite.sock;
    }
}

1 个答案:

答案 0 :(得分:2)

似乎personalsite.ini文件包含套接字路径作为可能具有0或更多匹配的模式,可能与实际路径不匹配,因此将其更新为绝对路径将解决该问题。

在你的personalsite.ini中: 如果你替换

WebDriverWait wait = new WebDriverWait(driver, 30);
WebElement ele = driver.findElement(By.xpath("//input[@value='1']"));
wait.until(ExpectedConditions.visibilityOf(ele));
ele.click();

使用套接字位置的绝对路径

socket = $(base)/%(repo)/%(project)/%(project).sock

这将解决问题。

知道套接字位置后,您可以设计一个与之匹配的模式。

nginx配置中的示例位置:

socket = /home/andrew/andrew-django-personal-site/personalsite/personalsite.sock