Install passenger program that will run your rails application
1. sudo gem install passenger
Install nginx server with passenger enabled
2. passenger-install-nginx-module
it will open apt, click "Enter" to contine
then select option 1 for default install
then it will ask
Where do you want to install Nginx to?
Please specify a prefix directory [/opt/nginx]:
press enter
then copy following block
server {
listen 80;
server_name www.yourhost.com;
root /somewhere/public; # <--- be sure to point to 'public'!
passenger_enabled on;
}
Make nginx Configuration
3. vi /opt/nginx/conf/nginx.conf
Make passenger_root and passenger_ruby path to configuration
http {
passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.4;
passenger_ruby /usr/local/bin/ruby;
then add server configuration block inside http block
http{
...
server {
listen 80;
server_name www.yourhost.com; //Make sure this dns entry inside /etc/hosts
root /carsonline/public; # <--- be sure to point to 'public'! //here carsonline is RAILS_ROOT
passenger_enabled on;
}
Thats, all
4. Launch Server
/opt/nginx/sbin/nginx