Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 3.1, nginx, Passenger directory index forbidden

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?

like image 396
alexlod Avatar asked Nov 15 '11 05:11

alexlod


2 Answers

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.

passenger_root /usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9;
passenger_ruby /usr/local/rvm/wrappers/ruby-1.9.2-p290/ruby;
like image 177
alexlod Avatar answered Oct 21 '22 15:10

alexlod


If you already have passenger_root and passenger_ruby in your nginx.conf, but having this error, you must have some location blocks. Then you must specify passenger_enabled on; inside each location block.

like image 11
Jiemurat Avatar answered Oct 21 '22 14:10

Jiemurat