I'm getting the following error in nginx (with a 403) when I visit .com:
[error] 5384#0: *1 directory index of "/u/apps/<app-name>/current/public/" is forbidden
I'm on Ubuntu 10.04 and I can't for the life of me get nginx, Passenger, Rails 3.1, and Capistrano to play nicely.
I'm deploying to /u with Capistrano. Everything in /u is 755, owned by the app user.
/u/apps//current/public/ has all my assets, the favicon, and everything else you'd expect.
When I add autoindex on
to nginx.conf I get a listing of the public/ directory, which leads me to believe that I don't have a permission problem.
My nginx.conf file is default expect for:
server {
listen 80;
server_name <app-name>.com;
passenger_enabled on;
root /u/apps/<app-name>/current/public/;
}
And my Capistrano deploy.rb file has nothing unusual.
Any ideas why the rails app doesn't seem to be starting?
In case you are running into this with Passenger 5+ and your Rails app is a 2.3.x app, you now need to add a
config.ru
file to your app:More details in the official announcement and github ticket.
I know the OP's question was about Rails 3.1 specifically but wanted to include this here since the output is identical and searches led me to this post.
If you already have
passenger_root
andpassenger_ruby
in yournginx.conf
, but having this error, you must have some location blocks. Then you must specifypassenger_enabled on;
inside each location block.Alright, I answered my own question. I was missing passenger_ruby and passenger_root configurations in my nginx.conf file. Note that the passenger_ruby path needs to be the wrapper if you're using RVM.
Sorry to answer to an old question, but it seems relevant (at least for me ;-) ) I had a similar problem and manage to solve it thanks to this post but in a different way. Alternatively, you can setup the /etc/nginx/nginx.conf to use:
And then make sure the locations.ini is current by running:
As said, this worked for me, though I'm not an expert, maybe I'm playing with the wrong parameters.