简体   繁体   English

Nginx 403:目录索引“ / home / deploy / MyApp / current / public /”被禁止

[英]Nginx 403: directory index of “/home/deploy/MyApp/current/public/” is forbidden

I have set up a rails project with nginx and passenger. 我已经与Nginx和Passenger建立了Rails项目。 I'm getting a 403 when trying to access the site. 尝试访问该网站时收到403。 This is my config file at /etc/nginx/sites-enabled/mysite.com : 这是我的配置文件,位于/etc/nginx/sites-enabled/mysite.com

server {
        listen 80;

        server_name www.mysite.com *.mysite.com;
        passenger_enabled on;
        rails_env production;
        root /home/deploy/mysite/current/public;
        index index.html index.htm;

        #try_files $uri;

        # redirect server error pages to the static page /50x.html
        error_page   500 502 503 504  /50x.html;

        location / {
                try_files $uri $uri/ /index.html;
        }

        location = /50x.html {
            root   html;
        }

}

My passenger_root and passenger_ruby are correctly set in nginx.conf and I have set write/read permissions on the app's root/, root/current and root/current/public folders for the nginx user. nginx.conf中正确设置了我的passenger_rootpassenger_ruby ,并且为nginx用户设置了应用程序的root /,root / current和root / current / public文件夹的写/读权限。

Any ideas? 有任何想法吗? Thx in advance. 提前谢谢。

You need to specify these two options as well 您还需要指定这两个选项

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;

You can check the path of your passenger installation with 您可以使用以下方法检查乘客的安装路径

passenger-config --root

And Ruby version with 和Ruby版本一起

which ruby

compare these outputs with what you specify. 将这些输出与您指定的输出进行比较。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM