Created
April 28, 2013 00:56
-
-
Save thanhleviet/5475366 to your computer and use it in GitHub Desktop.
This file contains hidden or 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:gunicorn] | |
command=/bin/gunicorn -w 4 myapp:app | |
environment=MY_ENV=/var/null | |
user=www-data |
This file contains hidden or 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
user www-data; | |
worker_processes 1; | |
error_log /var/log/nginx/error.log; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include mime.types; | |
default_type application/octet-stream; | |
access_log /var/log/nginx/nginx.access.log combined; | |
sendfile on; | |
upstream app_server { | |
server 127.0.0.1:8000 fail_timeout=0; | |
} | |
server { | |
listen *:8420; | |
server_name __; | |
rewrite ^ https://example.com permanent; | |
} | |
server { | |
listen 80 default; | |
client_max_body_size 4G; | |
server_name _; | |
real_ip_header X-Forwarded-For; | |
set_real_ip_from 0.0.0.0/0; | |
keepalive_timeout 5; | |
location / { | |
# checks for static file, if not found proxy to app | |
try_files $uri @proxy_to_app; | |
} | |
location @proxy_to_app { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_pass http://app_server; | |
proxy_redirect default; | |
proxy_redirect http://example.com/ https://example.com/; | |
proxy_buffering off; | |
} | |
} | |
} |
This file contains hidden or 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
[unix_http_server] | |
file=/var/run/supervisor.sock ; (the path to the socket file) | |
[supervisord] | |
logfile=/var/log/supervisord.log ; (main log file;default $CWD/supervisord.log) | |
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB) | |
logfile_backups=10 ; (num of main logfile rotation backups;default 10) | |
loglevel=info ; (log level;default info; others: debug,warn,trace) | |
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid) | |
nodaemon=false ; (start in foreground if true;default false) | |
minfds=1024 ; (min. avail startup file descriptors;default 1024) | |
minprocs=200 ; (min. avail process descriptors;default 200) | |
[rpcinterface:supervisor] | |
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface | |
[supervisorctl] | |
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket | |
[include] | |
files = supervisor/*.conf |
This file contains hidden or 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
#! /bin/bash -e | |
### BEGIN INIT INFO | |
# Provides: supervisor | |
# Required-Start: ec2-get-user-data | |
# Required-Stop: | |
# Should-Start: | |
# Should-Stop: | |
# Default-Start: 2 | |
# Default-Stop: | |
# Description: Start supervisord | |
### END INIT INFO | |
SUPERVISORD=/bin/supervisord | |
PIDFILE=/var/run/supervisor.pid | |
OPTS="-c /etc/supervisord.conf" | |
test -x $SUPERVISORD || exit 0 | |
. /lib/lsb/init-functions | |
export PATH="${PATH:+$PATH:}/usr/local/bin:/usr/sbin:/sbin" | |
case "$1" in | |
start) | |
log_begin_msg "Starting Supervisor daemon manager..." | |
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $SUPERVISORD -- $OPTS || log_end_msg 1 | |
log_end_msg 0 | |
;; | |
stop) | |
log_begin_msg "Stopping Supervisor daemon manager..." | |
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE || log_end_msg 1 | |
log_end_msg 0 | |
;; | |
restart|reload|force-reload) | |
log_begin_msg "Restarting Supervisor daemon manager..." | |
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $PIDFILE | |
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $SUPERVISORD -- $OPTS || log_end_msg 1 | |
log_end_msg 0 | |
;; | |
*) | |
log_success_msg "Usage: /etc/init.d/supervisor {start|stop|reload|force-reload|restart}" | |
exit 1 | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment