我创建了一个不使用虚拟环境的django应用程序。我已经安装了nginx并尝试通过uwsgi应用程序集成它们。 这是我的配置文件。
[uwsgi]
chdir = /home/elastic/workspace/ES_Brevetti
wsgi-file = ES_Brevetti/wsgi.py
master = true
processes = 5
uid = nginx
gid = nginx
socket = unix:///socket/uwsgi.sock
chmod-socket = 666
vacuum = true
我已经使用权限777创建了文件/sockect/uwsgi.sock
chown nginx:nginx -R /sockect/uwsgi.sock
以及nginx conf文件:
upstream django {
server unix:///socket/uwsgi.sock; # for a file socket
#server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}
server {
listen 80;
server_name 10.184.2.231;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
charset utf-8;
location /static/ {
alias /home/elastic/workspace/ES_Brevetti;
}
location / {
include uwsgi_params;
uwsgi_pass unix:///socket/uwsgi.sock;
}
}
当我启动" systemctl start nginx" nginx启动时出错: 连接到上游时connect()到unix:///socket/uwsgi.sock失败(111:拒绝连接),
当我运行uwsgi --ini /etc/uwsgi/sites/ES_Brevetti.ini时,它运行时没有错误:
.....
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
bind(): Permission denied [core/socket.c line 230]
我做错了什么?在谷歌我只能看到配置VENV而我没有使用虚拟环境。
答案 0 :(得分:0)
docs(我猜你在跟踪)建议你的uwsgi ini文件中的socket
配置选项应该是一个到套接字的路径,而不是一个URL。你能尝试改变吗?
[uwsgi]
...
socket = unix:///socket/uwsgi.sock
到
[uwsgi]
...
socket = /socket/uwsgi.sock
答案 1 :(得分:0)
解决方案是在uwsgi.ini文件中将socket = unix:///socket/uwsgi.sock更改为socket = /socket/uwsgi.sock。我不知道为什么在某些文档中它似乎是逃避的双重斜杠。