Last active
December 20, 2015 17:59
-
-
Save naokits/6172592 to your computer and use it in GitHub Desktop.
Pssenger memo
This file contains 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
Ubuntu 12.04 production environment for Ruby 2, Rails 4, Nginx and Passenger (work in progress) | |
#install required packages | |
apt-get update | |
apt-get upgrade -y | |
apt-get install -y git curl build-essential libssl-dev libcurl4-openssl-dev nodejs | |
#optional | |
apt-get install libsqlite3-dev sqlite3 | |
#create deployment user | |
adduser deployer | |
addgroup deployer sudo | |
su deployer | |
#install rbenv, ruby and bundler | |
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile | |
echo 'eval "$(rbenv init -)"' >> ~/.profile | |
exec $SHELL -l | |
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build | |
rbenv install 2.0.0-p195 | |
rbenv global 2.0.0-p195 | |
gem install bundler | |
#install passenger | |
gem install passenger | |
rbenv rehash | |
passenger-install-nginx-module | |
#choose option 1 | |
#install on /home/deployer/nginx | |
server { | |
listen 80; | |
server_name www.yourhost.com; | |
root /somewhere/public; # <--- be sure to point to 'public'! | |
passenger_enabled on; | |
} | |
This file contains 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
Nginx with Passenger support was successfully installed. | |
The Nginx configuration file (/home/naokits/nginx/conf/nginx.conf) | |
must contain the correct configuration options in order for Phusion Passenger | |
to function correctly. | |
This installer has already modified the configuration file for you! The | |
following configuration snippet was inserted: | |
http { | |
... | |
passenger_root /home/naokits/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/passenger-4.0.10; | |
passenger_ruby /home/naokits/.rbenv/versions/2.0.0-p247/bin/ruby; | |
... | |
} | |
After you start Nginx, you are ready to deploy any number of Ruby on Rails | |
applications on Nginx. | |
Press ENTER to continue. | |
-------------------------------------------- | |
Deploying a Ruby on Rails application: an example | |
Suppose you have a Ruby on Rails application in /somewhere. Add a server block | |
to your Nginx configuration file, set its root to /somewhere/public, and set | |
'passenger_enabled on', like this: | |
server { | |
listen 80; | |
server_name www.yourhost.com; | |
root /somewhere/public; # <--- be sure to point to 'public'! | |
passenger_enabled on; | |
} | |
And that's it! You may also want to check the Users Guide for security and | |
optimization tips and other useful information: | |
/home/naokits/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/passenger-4.0.10/doc/Users guide Nginx.html | |
Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-) | |
https://www.phusionpassenger.com | |
Phusion Passenger is a trademark of Hongli Lai & Ninh Bui. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment