【发布时间】:2016-05-29 23:23:02
【问题描述】:
我在 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 也不起作用。
感谢您的帮助:)
【问题讨论】:
标签: django nginx uwsgi limited-user