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
I think passenger_root and passenger_ruby get automatically configured during installation.Good article.
You are right..but sometimes we have to manually configure it when there are multiple ruby installations.
Hi Sandip,
I have recently configured nginx-passenger.
With the latest version of passenger
passenger (5.0.7)
I am able to start nginx and getting default page of nginx saying ..”Welcome to nginx!”
But I am not sure why definded project is not running with this:
Though it’s working when I run with “passenger start -e production”
Find below configurations which i did :
server {
listen 80;
server_name http://www.my-projecttracker.com;
root /home/rahul/work_space/redmine/public;
passenger_enabled on;
rails_env production;
}
and
http {
passenger_root /home/rahul/.rvm/gems/ruby-1.9.3-p194@my-projecttracker/gems/passenger-5.0.7;
passenger_ruby /home/rahul/.rvm/wrappers/ruby-1.9.3-p194@my-projecttracker/ruby;
Can you suggest what I have missed ?
Advance thanks for yout help…:)