Rails 3.1,nginx,禁止乘客目录索引 [英] Rails 3.1, nginx, Passenger directory index forbidden
问题描述
当我访问.com时,我在nginx中收到以下错误(带有403):
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
我使用的是Ubuntu 10.04,我一生都无法让nginx,Passenger,Rails 3.1和Capistrano表现出色.
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.
我正在与Capistrano一起部署到/u. /u中的所有内容均为755,由应用程序用户拥有.
I'm deploying to /u with Capistrano. Everything in /u is 755, owned by the app user.
/u/apps//current/public/拥有我的所有资产,收藏夹图标以及所有您期望的其他东西.
/u/apps//current/public/ has all my assets, the favicon, and everything else you'd expect.
当我在nginx.conf中添加autoindex on
时,会得到public/目录的列表,这使我相信我没有权限问题.
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.
我的nginx.conf文件默认为:
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/;
}
我的Capistrano deploy.rb文件没有异常.
And my Capistrano deploy.rb file has nothing unusual.
关于Rails应用程序似乎没有启动的任何想法吗?
Any ideas why the rails app doesn't seem to be starting?
推荐答案
好的,我回答了我自己的问题.我在nginx.conf文件中缺少passenger_ruby和passenger_root配置.请注意,如果您使用的是RVM,passenger_ruby路径必须是包装器.
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;
这篇关于Rails 3.1,nginx,禁止乘客目录索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!