我在Nginx uWSGI中安装了Django.我可以在当前登录的用户(在几天前要求question的帮助下)下正常运行,但现在我想以受限用户身份运行uwsgi –ini uwsgi.ini.
到目前为止,这是我所做的:
1.创建了一个没有登录访问权限且没有主目录的用户djangouser.
2.将用户Nginx添加到组djangouser中
3.将我的django文件放到/ mnt / django目录中,并将django的文件权限更改为drwxrwx — djangouser djangouser(递归)
4.更改了conf文件以匹配文件位置
uwsgi.ini文件
[uwsgi]
chdir=/mnt/django/project/awssite
module=awssite.wsgi
home=/mnt/django/project
master=true
processes=2
uid=djangouser
gid=djangouser
socket=/mnt/django/djangosocket/awssite.socket
chmod-socket
vacuum=true
当我尝试运行uwsgi –ini uwsgi.ini时,这是我得到的错误
[uWSGI] getting INI configuration from uwsgi.ini
*** Starting uWSGI 2.0.12 (64bit) on [Thu Feb 18 00:18:25 2016] ***
compiled with version: 4.8.3 20140911 (Red Hat 4.8.3-9) on 01 February 2016 04:17:11
os: Linux-4.1.13-19.31.amzn1.x86_64 #1 SMP Wed Jan 20 00:25:47 UTC 2016
nodename: ip-10-200-1-89
machine: x86_64
clock source: unix
detected number of cpu cores: 1
current working directory: /home/ec2-user
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support,rebuild with pcre support !!!
chdir() to /mnt/django/project/awssite
chdir(): Permission denied [core/uwsgi.c line 2586]
chdir(): Permission denied [core/uwsgi.c line 1608]
注意:当我将登录用户添加到djangouser组时,uwsgi –ini uwsgi.ini运行良好,并且能够加载django页面.
我不确定要在何处添加权限以使其正常工作.在uwsgi.ini中添加sudo chown-socket = djangouser:djangouser也不起作用.
我感谢您的帮助:)
最佳答案