Home / nginx uwsi تنظیم

nginx uwsi تنظیم



برای حل مشکل دسترسی به
پوشه کاربر
/home/user
بهتر است مسیر قرار دادن پروژه در آدرسی شبیه به زیر باشد
/src/Apps
اول تست می کنیم ببینم کار می کنه
uwsgi --http :8080 --home /home/project/source/ --chdir /home/project/source/ -w project.wsgi
بعد تنظیمات را درون فایل می ریزیم
تنظیمات uwsgi
config/project.ini
[uwsgi]
virtualenv=/home/userhome/pyenv/
master = true
processes = 5
socket = /socket/project.sock
chmod-socket = 777
vacuum = true
die-on-term = true
vhost=true
master=True
env = DJANGO_SETTINGS_MODULE=project.production_settings
req-logger = file:log/reqlog
chdir=/home/userhome/project
module=project.production_wsgi:application

تنظیمات nginx
/etc/nginx/conf.d/project.conf

server {
    listen 80;
    server_name  site.ir;
location /static/admin {
alias /home/userhome/pyenv/lib/python2.7/site-packages/django/contrib/admin/static/admin/;
}
location /static {
                alias /home/userhome/project/static/ui/;
                }
location / {
 include         uwsgi_params;

        uwsgi_pass unix:/socket/project.sock;
    }
}

تنظیم سطح دسترسی ها برای فایل های استاتیک
chown :nginx /home/userhome/project/source/statics/ -R

Default User Home Directory Permissions

So it seems that the default permissions on user home directories in Ubuntu 12.04 is 700.** Nginx needs to have read permission the files that should be served AND have execute permission in each of the parent directories along the path from the root to the served files.**

You can give your user directory these permissions by running

chmod 701 user_home

You may also use 755, which is the default permission setting on the home directory on many systems.

The directories/files in your web root can belong to the www-data user or your regular personal user as long as theuser/group that nginx runs as (as defined in nginx.conf) has READ permission on all files to be served and execute permission on all web root directories.

I just set all directories in my web root to be owned by my user account and have permissions 755 and I set all files to be served from the web root to have permissions 664 since these were the defaults on my machine.



uwsgi --ini config/project.ini


service nginx restart




     RSS of this page