Last active
May 21, 2020 15:34
-
-
Save chumaumenze/33c27aa1730c44f1a70cb64c46589d11 to your computer and use it in GitHub Desktop.
Basic Gunicorn/Supervisor/Nginx config for deploying Python apps.
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
import multiprocessing | |
bind = '0.0.0.0:8000' | |
workers = multiprocessing.cpu_count() | |
worker_class = 'gevent' | |
accesslog = '/var/log/progam_name/gunicorn/access.log' | |
errorlog = '/var/log/progam_name/gunicorn/error.log' | |
loglevel = 'debug' | |
access_log_format = '[%(h)15s] (%(s)s) [%(D)8sms] %(r)s | %(b)sb' | |
proc_name = 'progam_name_gunicorn' | |
timeout = 15 |
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
server { | |
listen 80; | |
listen [::]:80; | |
# SSL | |
# listen 443; | |
# listen [::]:443; | |
server_name YOUR_SERVER_NAME; | |
access_log /var/log/progam_name/nginx/access.log; | |
error_log /var/log/progam_name/nginx/error.log; | |
location / { | |
proxy_pass http://127.0.0.1:8000/; | |
proxy_redirect off; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
} | |
} |
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
[program:progam_name] | |
command=pipenv run gunincorn main:app -c conf/gunicorn_conf.py | |
directory=/home/username/apps/progam_name | |
autostart=true | |
autorestart=true | |
stderr_logfile=/var/log/progam_name/supervisor/err.log | |
stdout_logfile=/var/log/progam_name/supervisor/out.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment