Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I've been searching for an answer for a long time now so I'll just try here...

I'm trying to get an Ruby on Rails application running with passenger and nginx but I'm getting 403 forbidden when I'm trying to enter my site. (Server is running Fedora 17 x64). and this is how I've done this far.

I followed the instructions on this guide:
Generic installation, upgrade and downgrade method: via RubyGems

After running passenger-install-nginx-module I opend nginx.conf and added, inside the HTTP block, my server block which looks like this:

server {
     listen 80;
     server_name www.mydomain.com;
     root /home/username/rails-live/rails-app/public;
     rails_env development;
     passenger_enabled on;
}

(I've also set user to www-data and chown'ed /rails-app recursivly to www-data)

Then I created an init.d script for starting/stopping/restarting following this guide here:
Red Hat Nginx Init Script

(I changed the path for nginx to where passenger installed it)

Now I can start/stop/restart nginx without any problems, and when I visit my domain (without www. in the url) I'm getting to the "Welcome to nginx!" site, so nginx seems to be working.

It dosen't look like Ruby is running while nginx is (I really don't know if it should, but it's just for info that might be usefull) When I run the following commands in the terminal it looks like this.

[root@server username]# ps aux | grep nginx

root     23497  0.0  0.1  53716  1036 ?        Ss   Apr23   0:00 nginx: master process /opt/nginx/sbin/nginx
www-data 23498  0.0  0.1  54120  2004 ?        S    Apr23   0:00 nginx: worker process
root     23601  0.0  0.0 109404   868 pts/1    S+   00:04   0:00 grep --color=auto nginx


[root@server username]# ps aux | grep ruby

root     23612  0.0  0.0 109404   868 pts/1    S+   00:06   0:00 grep --color=auto ruby

I'm also using gem 'thin' in my rails-app so I checked that too, just in case.

[root@server username]# ps aux | grep thin

root     23616  0.0  0.0 109404   868 pts/1    S+   00:06   0:00 grep --color=auto thin

I'm stuck here and I could really need some help!

share|improve this question

migrated from superuser.com Apr 25 '13 at 3:47

This question came from our site for computer enthusiasts and power users.

add comment

2 Answers 2

If you server is running Nginx+Passeneger , you can start your Ruby application in the following way:

cd /home/user/rails_apps/user; sudo -u user /usr/local/bin/ruby /usr/local/bin/passenger start -p 12045 -e production &

sudo -u user /usr/local/bin/ruby /usr/local/bin/passenger start -p 12421 -e production & - the command for running is screen

/home/user/rails_apps/user]# passenger stop -p 12045

/home/user/rails_apps/user]# passenger start -p 12045

share|improve this answer
add comment

Check the permissions for /home/username/rails-live/rails-app/public.

Make sure the user running Nginx has read and execute permissions.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.