Created
May 4, 2010 08:54
-
-
Save arunthampi/389157 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
################################################## | |
Install the passenger gem | |
################################################## | |
$ gem install passenger | |
############################################################################## | |
Install the Passenger-Nginx module | |
Choose all default options. (1. for Passenger to compile and install nginx) | |
############################################################################## | |
$ sudo passenger-install-nginx-module | |
################################################## | |
Enter the following in ~/.scripts/nginx-dir.conf | |
################################################## | |
daemon off; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include /opt/nginx/conf/mime.types; | |
# Assuming path has been set to a Rails application | |
access_log log/nginx.access.log; | |
error_log log/nginx.error.log; | |
client_body_temp_path tmp/nginx.client_body_temp; | |
fastcgi_temp_path tmp/nginx.client_body_temp; | |
proxy_temp_path tmp/nginx.proxy_temp; | |
passenger_root /Library/Ruby/Gems/1.8/gems/passenger-2.2.11; | |
passenger_ruby /usr/bin/ruby; | |
server { | |
listen 80; | |
server_name gameplanapp.local; | |
root public; | |
passenger_enabled on; | |
# rails_env development; | |
rack_env development; | |
} | |
} | |
############################################ | |
Enter the following in ~/.scripts/nginx.sh | |
############################################ | |
#!/usr/bin/env bash | |
# From http://freelancing-gods.com/posts/script_nginx | |
echo "Starting Phusion Passenger via Nginx in `pwd`:" | |
# Make directories if needed | |
[ ! -d `pwd`/tmp ] && mkdir `pwd`/tmp | |
[ ! -d `pwd`/log ] && mkdir `pwd`/log | |
/opt/nginx/sbin/nginx -p `pwd`/ -c ~/.scripts/nginx-dir.conf -g "error_log `pwd`/log/nginx.error.log; pid `pwd`/log/nginx.pid;"; | |
############################################ | |
Change permissions for ~/.scripts/nginx.sh | |
############################################ | |
$ chmod +x ~/.scripts/nginx.sh | |
############################################ | |
Add ~/.scripts/ to your path in ~/.bashrc | |
############################################ | |
export PATH=$PATH:~/.scripts | |
################################################# | |
To run goto the Rails project and run nginx.sh | |
################################################# | |
$ cd ~/git/rails_project | |
$ sudo nginx.sh | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment