From 46db2ec2d6fb857e159f4ce628c1ce7fbcbcc951 Mon Sep 17 00:00:00 2001 From: Ian Adam Naval Date: Tue, 28 Jan 2014 01:51:06 -0500 Subject: [PATCH] Added configuration files for deployment. --- conf/nginx.conf | 40 ++++++++++++++++++++++++++++++++++++++++ conf/supervisord.conf | 24 ++++++++++++++++++++++++ requirements.txt | 2 ++ src/ianonavy.fcgi | 6 ++++++ 4 files changed, 72 insertions(+) create mode 100644 conf/nginx.conf create mode 100644 conf/supervisord.conf create mode 100644 requirements.txt create mode 100755 src/ianonavy.fcgi diff --git a/conf/nginx.conf b/conf/nginx.conf new file mode 100644 index 0000000..2e76bf4 --- /dev/null +++ b/conf/nginx.conf @@ -0,0 +1,40 @@ +server { + listen 80; + listen 443 default_server ssl; + + ssl_certificate /var/sites/ianonavy.com/ssl/unified.crt; + ssl_certificate_key /var/sites/ianonavy.com/ssl/ssl-decrypted.key; + + server_name *.ianonavy.com ianonavy.com www.ianonavy.com; + + access_log /var/log/nginx/ianonavy.access.log; + error_log /var/log/nginx/ianonavy.error.log; + + if ($host != 'ianonavy.com') { + rewrite ^/(.*)$ http://ianonavy.com/$1 permanent; + } + + root /var/sites/ianonavy.com/www; + + location = /robots.txt { + alias /var/www/robots/all/robots.txt; + } + + location /static/ { # STATIC_URL + alias /var/sites/ianonavy.com/www/src/static/; # STATIC_ROOT + expires off; + } + + location = /google9677fb7678857b96.html { + rewrite ^/(.*) $1; + return 200 "google-site-verification: google9677fb7678857b96.html"; + } + + location / { try_files $uri @ianonavy; } + location @ianonavy { + include fastcgi_params; + fastcgi_param PATH_INFO $fastcgi_script_name; + fastcgi_param SCRIPT_NAME ""; + fastcgi_pass unix:/tmp/ianonavy-fcgi.sock; + } +} diff --git a/conf/supervisord.conf b/conf/supervisord.conf new file mode 100644 index 0000000..d74983d --- /dev/null +++ b/conf/supervisord.conf @@ -0,0 +1,24 @@ +[fcgi-program:ianonavy] +command=/var/sites/ianonavy.com/www/src/ianonavy.fcgi +socket=unix:///tmp/ianonavy-fcgi.sock +process_name=%(program_name)s_%(process_num)02d +directory=/var/sites/ianonavy.com/www/src +environment=PATH="/var/sites/ianonavy.com/www/bin" +numprocs=5 +priority=999 +autostart=true +autorestart=true +startsecs=1 +startretries=3 +exitcodes=0,2 +stopsignal=QUIT +stopwaitsecs=10 +user=app +redirect_stderr=true +stdout_logfile=/tmp/ianonavy.log +stdout_logfile_maxbytes=1MB +stdout_logfile_backups=10 +stderr_logfile=/tmp/ianonavy_err.log +stderr_logfile_maxbytes=1MB +stderr_logfile_backups=10 + diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..5e605c2 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +Flask +flup \ No newline at end of file diff --git a/src/ianonavy.fcgi b/src/ianonavy.fcgi new file mode 100755 index 0000000..448b011 --- /dev/null +++ b/src/ianonavy.fcgi @@ -0,0 +1,6 @@ +#!/usr/bin/env python +from flup.server.fcgi import WSGIServer +from server import app + +if __name__ == '__main__': + WSGIServer(app, bindAddress='/tmp/ianonavy-fcgi.sock', umask=0002).run()