Skip to content

Instantly share code, notes, and snippets.

@hiendnguyen
Last active November 3, 2019 06:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiendnguyen/cea79000156ada8c7e8cf9825433a9ff to your computer and use it in GitHub Desktop.
Save hiendnguyen/cea79000156ada8c7e8cf9825433a9ff to your computer and use it in GitHub Desktop.
Configure uWSGI as service
# Create 'uwsgi' user: unprivileged user
useradd -s /bin/false -r uwsgi
# Emperor mode
## create a directory for the vassals
- mkdir -p /etc/uwsgi/vassals
## Configuring uWSGI to run with a .ini file
vi /var/www/example/djangodemo/djangodemo_uwsgi.ini
### Put below content in djangodemo_uwsgi.ini
[uwsgi]
# Django-related settings
# the base directory (full path)
chdir = /var/www/example/djangodemo/
# Django's wsgi file
module =djangodemo.wsgi
# the virtualenv (full path)
home = /var/www/p3venv
# Logs
logdate = True
logto = /var/log/uwsgi/access.log
# process-related settings
# master
master = true
# maximum number of worker processes
processes = 5
# the socket (use the full path to be safe)
socket = /run/uwsgi/django.sock
# ... with appropriate permissions - may be needed
chmod-socket = 666
# clear environment on exit
vacuum = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment