Created
February 8, 2013 10:46
-
-
Save creativepsyco/4738070 to your computer and use it in GitHub Desktop.
Deploy Scripts (FASTCGI)
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 | |
set -ef | |
domain="YOUR_DOMAIN" | |
module="key" | |
wwwdir="/var/www" | |
rootdir=$wwwdir/$domain | |
staticdir=$rootdir/static | |
cgidir=$rootdir/fastcgi | |
logdir=$rootdir/log | |
managedir=$cgidir/$module | |
if [ -d $rootdir ] | |
then | |
echo "back up "$domain" ..." | |
mv $rootdir $rootdir-`date +%Y_%m_%d_%H_%M_%S` | |
fi | |
mkdir $rootdir | |
mkdir $staticdir | |
mkdir $cgidir | |
cp -r $module $cgidir/ | |
cp -r $module/static/media $staticdir | |
mkdir $logdir | |
configs=$managedir/$module/config.py | |
echo "using LOG_FILE = "$logdir/django | |
echo "LOG_FILE = '"$logdir/django"'" >> $configs |
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
server { | |
listen 80; | |
server_name YOUR_DOMAIN; | |
access_log /var/log/nginx/YOUR_DOMAIN.access.log; | |
error_log /var/log/nginx/YOUR_DOMAIN.error.log; | |
#error_page 404 /404.html; | |
# redirect server error pages to the static page /50x.html | |
# | |
error_page 500 502 503 504 /50x.html; | |
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mov) { | |
access_log off; | |
expires 30d; | |
root /var/www/YOUR_DOMAIN/static/; | |
} | |
location = /50x.html { | |
root /usr/share/nginx/html; | |
} | |
# FastCGI | |
location / { | |
fastcgi_pass 127.0.0.1:8100; | |
fastcgi_param PATH_INFO $fastcgi_script_name; | |
fastcgi_param QUERY_STRING $query_string; | |
fastcgi_param REQUEST_METHOD $request_method; | |
fastcgi_param CONTENT_TYPE $content_type; | |
fastcgi_param CONTENT_LENGTH $content_length; | |
fastcgi_param REQUEST_URI $request_uri; | |
fastcgi_param DOCUMENT_URI $document_uri; | |
fastcgi_param DOCUMENT_ROOT $document_root; | |
fastcgi_param SERVER_PROTOCOL $server_protocol; | |
fastcgi_param GATEWAY_INTERFACE CGI/1.1; | |
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; | |
fastcgi_param REMOTE_ADDR $remote_addr; | |
fastcgi_param REMOTE_PORT $remote_port; | |
fastcgi_param SERVER_ADDR $server_addr; | |
fastcgi_param SERVER_PORT $server_port; | |
fastcgi_param SERVER_NAME $server_name; | |
fastcgi_pass_header Authorization; | |
fastcgi_intercept_errors off; | |
} | |
rewrite ^/favicon.ico$ http://cdn.YOUR_DOMAIN/webmain/static/favicon.ico; | |
} |
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 | |
set -ef | |
domain="YOUR_DOMAIN" | |
port=8081 | |
module="key" | |
wwwdir="/var/www" | |
if [ -z $domain ] | |
then | |
echo "domain name is not specified" | |
exit 1 | |
fi | |
rootdir=$wwwdir/$domain/fastcgi | |
pidfile="$rootdir/$domain.pid" | |
if [ -f $pidfile ]; then | |
kill `cat -- $pidfile` | |
rm -f -- $pidfile | |
fi | |
#exec /usr/bin/env - | |
# PYTHONPATH="../python:.." \ | |
python $rootdir/$module/manage.py runfcgi host=127.0.0.1 port=$port pidfile=$pidfile |
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/sh | |
set -ef | |
domain="YOUR_DOMAIN" | |
module='YOUR_MODULE' | |
wwwdir="/var/www" | |
if [ -z $domain ] | |
then | |
echo "domain name is not specified" | |
exit 1 | |
fi | |
rootdir=$wwwdir/$domain/fastcgi | |
pidfile="$rootdir/$domain.pid" | |
if [ -f $pidfile ]; then | |
kill `cat -- $pidfile` | |
rm -f -- $pidfile | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment