linux - File permissions for Django: Gunicorn, Nginx, and Static Files -


I have a standard Ubuntu 14.04 machine. I use it daily under user mh00h . I'm interested in using this machine as a production server. How can I manage file permissions for Django and Nginx?

Nginx is currently configured to run under www-data: www-data . This reduces the risk of the rest of a machine. Django / gunicorn should be similarly run under a user other than mh00h . But what under the user can actually run Gunocorn? Any , right?

Next: I am storing all my web development files under / home / mh00h / development . Owned by mh00h / home / mh00h / development / project1 (all directories / files but / media and / static) ? Owned by mh00h I do the best practice of the two-pick of the Django to create a project directory with stable files inside it. Of course, now NGX will now have / home / mh00h / development / project1 / project1 / Static because all of those root directories are mh00h , not Www-data (. / Static Is owned by www-data ).

To make this case complicated, virtualenvwrapper creates my virtual environment under /home/mh00h/.virtualenvs/ .

I have two scoops best practices and store / static separate / var / www , because I have all these directories well on any other server But later I want to be packed together for easy transportation.

  1. Where should my static files be stored?
  2. Where do the dozens of specific files should be stored?
  3. Which user / group should be able to use 1 and 2?
  4. Where should the VirtualWorwer environment be stored?
  5. What permissions should these locations have?

    Thank you.

    All our files and directories output environment with 755/644 file permissions root: root < / Code>, unless otherwise necessary. Some private files (private keys, etc.) are read only by the user / process, while they are still descriptive by the root .

    For project structure: All our projects have a dedicated directory under /srv/www/vhosts.d/ . Virtual environments are submitted under / srv / www / virtualenvs . It is entirely possible to store them in your home folder, but I think this central approach is more with the idea of ​​the server to produce the right settings, all virtual envs are also available by all users.

    Many of our main project directories (manage.py and many deployment / update scripts) are included in the forward division outside subdirectores and it is: ie the web are public files, Src frontend contains the source folder included in the template folder and the saab folder. The entire project directory is included in the GIT repository, but deployment-specific files (user uploaded files, search index, encryption key) are all in the .git-ignore .

    Runs our NGN process as www-data . Normally each Django project has its own user, and the gunicorn process runs as user.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -