Last active
October 5, 2018 12:10
-
-
Save ErickMwazonga/ab1072e6136cb700135160748ed0e345 to your computer and use it in GitHub Desktop.
Deploy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-uwsgi-and-nginx-on-ubuntu-16-04 | |
# configuration of the server | |
server { | |
# the port your site will be served on | |
listen 80; | |
listen [::]:80; | |
# the domain name it will serve for | |
server_name 192.168.2.212; | |
charset utf-8; | |
# max upload size | |
client_max_body_size 75M; # adjust to tast | |
location = /favicon.ico { access_log off; log_not_found off; } | |
# Django media | |
location /media { | |
expires 28d; | |
access_log off; | |
root /home/erick/Desktop/MyProjects/Coke; | |
} | |
location /static { | |
expires 28d; | |
access_log off; | |
root /home/erick/Desktop/MyProjects/Coke; | |
} | |
# Finally, send all non-media requests to the Django server. | |
location / { | |
uwsgi_pass unix:///run/uwsgi/erick.sock; | |
include /etc/nginx/uwsgi_params; # the uwsgi_params file you installed | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[uwsgi] | |
# Django-related settings | |
# the base directory (full path) | |
chdir = /home/erick/Desktop/MyProjects/Coke | |
# Django's wsgi file | |
module = Coke.wsgi:application | |
# the virtualenv (full path) | |
home = /home/erick/.virtualenvs/ecoke | |
plugins = python3 | |
env = DJANGO_SETTINGS_MODULE=Coke.settings | |
# 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/erick.sock | |
chown-socket = erick:www-data | |
# ... with appropriate permissions - may be needed | |
chmod-socket = 666 | |
# clear environment on exit | |
vacuum = true | |
uid = erick | |
# set up for new relic | |
enable-threads = true | |
single-interpreter = true | |
lazy-apps = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/systemd/system/uwsgi.service | |
[Unit] | |
Description=uWSGI Emperor | |
After=syslog.target | |
[Service] | |
User=erick | |
Group=www-data | |
RuntimeDirectory=uwsgi | |
ExecStartPre=/bin/bash -c 'mkdir -p /run/uwsgi; chown erick:www-data /run/uwsgi' | |
ExecStart=/usr/bin/uwsgi_python35 --emperor /etc/uwsgi/sites | |
# Requires systemd version 211 or newer | |
Restart=always | |
KillSignal=SIGQUIT | |
Type=notify | |
StandardError=syslog | |
NotifyAccess=all | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment