Setting up uWSGI Server Permissions

General Tech Bugs & Fixes 2 years ago

0 1 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

I'm looking to deploy virtual machines to run a single instance of Django REST framework. I would like to use uWSGI since it seems pretty light weight and can be configured with a single file. I have figured out most of the configuration, and have SSL running just fine. These VMs are being deployed with cloud-init, so the bulk is taken care of with minimal scripting. Everything else will be done via SSH.

My question is: where should I place my Django application, and what permissions should be set on that folder? What about uWSGI log and ini file locations? For reference, these are my plans for the uWSGI ini and folder locations and permissions. Note, I am aware of this question (What permissions should my website files/folders have on a Linux webserver?), and have read it, but this assumes some things that are setup with an apache2 install I think, so I'm starting from scratch. I'm probably really wrong in a few places, so I'd welcome any suggestions:

[uwsgi]
shared-socket = :443
https = =0,fullchain.pem,privkey.pem,HIGH
uid = vmuser
gid = www-data
chdir = /var/www/vmuser/project
wsgi-file = project/wsgi.py
master=true
processes = 4
threads = 2
daemonize = /var/log/vmuser/uwsgi_443.log
safe-pidfile=/tmp/project_master_443.pid
check-static = /var/www/vmuser/webroot/
logfile-chown = true

Plan for web app folder (where I was going to put the Django install):

sudo mkdir -p /var/www/vmuser/webroot
sudo chown -R vmuser /var/www/vmuser/
sudo chgrp -R www-data /var/www/vmuser/
sudo chmod -R 750 /var/www/vmuser/
sudo chmod g+s /var/www/vmuser/

Plan for config files:

sudo mkdir -p /etc/vmuser
sudo chown -R vmuser /etc/vmuser/
sudo chgrp -R www-data /etc/vmuser/
sudo chmod -R 750 /etc/vmuser/
sudo chmod g+s /etc/vmuser/

Plan for log files:

sudo mkdir -p /var/log/vmuser
sudo chown -R vmuser /var/log/vmuser
sudo chgrp -R www-data /var/log/vmuser
sudo chmod -R 750 /var/log/vmuser
sudo chmod g+s /var/log/vmuser

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

tuteehub community

Join Our Community Today

Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.

tuteehub community