i ve创建了一个不使用虚拟环境的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
的file/sockect/uwsgi.sockchown 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启动了错误: 连接到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]
我做错了什么?在Google上,我只能在不使用虚拟环境时看到VENV的配置。
docs(我猜您正在关注),建议您在UWSGI INI文件中的socket
配置选项应采取通往套接字的路径,而不是URL。您可以尝试更改:
[uwsgi]
...
socket = unix:///socket/uwsgi.sock
to
[uwsgi]
...
socket = /socket/uwsgi.sock
解决方案是更改socket = unix = unix = unix = socket =/socket =/socket/uwsgi.sock uwsgi.ini文件中。我不知道为什么在某个文档中看起来是逃脱的双重斜线。