Created
February 21, 2011 19:19
-
-
Save DanielTheFirst/837548 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
#!/bin/sh | |
# | |
# One script to rule them all 2: Unicorn Strikes back | |
# | |
# Install Nginx from source and Install Unicorn | |
# Then configure such | |
# | |
# Author: Daniel Reslie | |
# Date: 2/21/2011 | |
# | |
NGINX_VERSION=0.8.54 | |
APP_LOCATION=/home/daniel/MyApp | |
GEM_LOCATION=/usr/local/lib/ruby/gems/1.9.1/gems | |
UNICORN_VERSION=3.4.0 | |
LOCAL_USER=daniel | |
LOCAL_GROUP=daniel | |
sudo gem install unicorn | |
sudo apt-get install build-essential libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlib1g-dev sysv-rc-conf | |
if [ ! -f nginx-${NGINX_VERSION}.tar.gz ]; then | |
wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz | |
fi | |
if [ -d nginx-${NGINX_VERSION} ]; then | |
rm -rf nginx-${NGINX_VERSION} | |
fi | |
tar -zxf nginx-${NGINX_VERSION}.tar.gz | |
cd nginx-${NGINX_VERSION} | |
./configure \ | |
--sbin-path=/usr/local/sbin \ | |
--conf-path=/etc/nginx/nginx.conf \ | |
--pid-path=/var/run/nginx.pid \ | |
--error-log-path=/var/log/nginx/error.log \ | |
--http-log-path=/var/log/nginx/access.log \ | |
--with-http_ssl_module \ | |
--http-client-body-temp-path=/tmp/nginx_client \ | |
--http-proxy-temp-path=/tmp/nginx_proxy \ | |
--http-fastcgi-temp-path=/tmp/nginx_fastcgi | |
# --add-module='/usr/local/src/passenger-2.2.7/ext/nginx' | |
make | |
sudo make install | |
#pull down my nginx.conf. if you aren't me you will need to change some settings like the specific location for the upstream and the user | |
wget https://gist.github.com/raw/837210/248d6222b5d1333079561ce58f437e94ba4c1ca3/nginx.conf | |
sudo cp nginx.conf /etc/nginx/nginx.conf | |
wget http://gist.github.com/raw/271062/0c90225766c62009010a8394f3cffc66da9e172a/nginx #hopefully this will still be there in the future | |
sudo mv nginx /etc/init.d/nginx | |
sudo chmod u+x /etc/init.d/nginx | |
sudo /etc/init.d/nginx start | |
sudo sysv-rc-conf --level 2345 nginx on | |
sudo cp ${GEM_LOCATION}/unicorn-${UNICORN_VERSION}/examples/unicorn.sh /etc/init.d/unicorn | |
sudo chmod u+x /etc/init.d/unicorn | |
sudo cp ${GEM_LOCATION}/unicorn-${UNICORN_VERSION}/examples/unicorn.conf.rb ${APP_LOCATION}/config/unicorn.rb | |
sudo chown daniel ${APP_LOCATION}/config/unicorn.rb | |
sudo chgrp daniel ${APP_LOCATION}/config/unicorn.rb | |
#running this will fails unless you modify the app specific settings in the init.d script such as APP_ROOT | |
# and if you don't moddify the app specific settings in unicorn.rb. | |
#sorry, i don't want to spend any time modifying this script to do that. | |
sudo /etc/init.d/unicorn start | |
sudo sysv-rc-conf --level 2345 unicorn on |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment