简体   繁体   English

Nginx-禁止目录索引为“ / var / fruby / current / public /”

[英]Nginx - directory index of “/var/fruby/current/public/” is forbidden

Okay, so this question must have been asked a couple of dozen of times already but I honestly went through all similiar question and none of these questions relate to my issue. 好的,所以这个问题一定已经问过几十遍了,但是老实说,我经历了所有类似的问题,这些问题都与我的问题无关。

So a little bit of history and configuration Rails 3 app, Passenger + Nginx 3 as production server 因此,有一些历史和配置Rails 3应用程序,Passenger + Nginx 3作为生产服务器

I am currently deploying my production Rails 3 app via bash script, that basically clones git repo every time and does some magic, it had its issues so we decided to migrate to Capistrano. 我目前正在通过bash脚本部署我的生产Rails 3应用程序,该应用程序基本上每次都会克隆git repo并进行一些魔术处理,由于存在问题,因此我们决定迁移到Capistrano。

Wrote the deploy.rb script, specified shared folders, started it all up on a test server first and managed to get it all up and running smoothly. 编写deploy.rb脚本,指定共享文件夹,首先在测试服务器上将其全部启动,然后设法使其全部正常运行。

Now I do same for production server, deployed it via Capistrano to separate from my manual bash script folder so they wont conflict in any way, changed nginx root from 现在,我对生产服务器进行同样的操作,通过Capistrano进行部署,使其与我的手动bash脚本文件夹分开,这样它们就不会发生任何冲突,将nginx根目录从

root /var/www/public;

to

root /var/fruby/current/public;

restarting nginx and I get a 403 error and the following record in logs. 重新启动nginx时,出现403错误和日志中的以下记录。

2014/06/08 18:28:32 [error] 5239#0: *1 directory index of "/var/fruby/current/public/" is forbidden, client: 109.187.177.116, server: example.com, request: "GET / HTTP/1.1", host: "example.com", referrer: ""

Since passenger configuration didn't change, its safe to assume that the problem is somewhere with folder permissions but I honestly can't seem to identify what the issue is in. Permissions so does owner really seem the same for me, perhaps you can point me in the right direction? 由于乘客配置没有更改,因此可以安全地假设问题出在文件夹权限中,但老实说我似乎无法确定问题所在。权限对我来说所有者确实如此,也许您可​​以指出我朝着正确的方向?

It has to be something to do with passenger, because if I manually start application with rails s, it starts up beautifully. 这必须与乘客有关,因为如果我手动使用rails启动应用程序,则启动效果会很好。

/opt/nginx/conf/nginx.conf /opt/nginx/conf/nginx.conf

Inside http block: 里面的http块:

passenger_root /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.18;
passenger_ruby /usr/local/bin/ruby;
proxy_read_timeout 640;

server block: 服务器块:

server {
    listen   443;
    server_name  example.com;

    ssl on;
    ssl_certificate /opt/nginx/conf/certs/example.com.crt;
    ssl_certificate_key /opt/nginx/conf/certs/example.com.key.nopass;

    charset utf-8;
    #root /var/www/public; # Old directory my bash script deployed to
    root /var/fruby/current/public; # New directory, capistrano deploys to
    passenger_enabled on;
    rails_env production;

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
}

Now fruby folder has these permissions: 现在,fruby文件夹具有以下权限:

drwxr-xr-x  5 root root   4096 Jun  8 18:56 fruby/

Inside fruby folder 里面的ruby文件夹

drwxr-xr-x  5 root root 4096 Jun  8 18:56 ./
drwxr-xr-x 17 root root 4096 Jun  8 17:31 ../
lrwxrwxrwx  1 root root   34 Jun  8 18:56 current -> /var/fruby/releases/20140608145412/
drwxr-xr-x  4 root root 4096 Jun  8 18:54 releases/
drwxr-xr-x  7 root root 4096 Jun  8 17:46 repo/
-rw-r--r--  1 root root  170 Jun  8 18:56 revisions.log
drwxr-xr-x  7 root root 4096 Jun  8 17:47 shared/

Inside shared folder 内部共享文件夹

drwxr-xr-x  7 root   root    4096 Jun  8 17:47 ./
drwxr-xr-x  5 root   root    4096 Jun  8 18:56 ../
drwxr-xr-x  2 root   root    4096 Jun  8 17:49 bin/
drwxr-xr-x  3 root   root    4096 Jun  8 17:47 bundle/
drwxr-xr-x  2 root   root    4096 Jun  8 17:51 log/
drwxr-xr-x 10 root   root    4096 Jun  8 17:24 public/
drwxr-xr-x  6 nobody nogroup 4096 Jun  8 18:56 tmp/

Everything seems to be fine and pretty much the same permissions, there are on production server. 生产服务器上的一切似乎都很好,并且权限几乎相同。

Let me know if you need any more output. 让我知道是否需要更多输出。

Any help is very much appreciated! 很感谢任何形式的帮助!

Managed to resolve this issue by updating Passenger to 4.0.44 and recompiling nginx (running passenger-install-nginx-module again), apparently this was the only difference with the test server I was testing with at first. 通过将Passenger更新为4.0.44并重新编译nginx(再次运行passenger-install-nginx-module )来设法解决了这个问题,显然这是与我最初使用的测试服务器的唯一区别。

Commands I ran to resolve the issue: 我运行以解决此问题的命令:

user@host-$: chmod 777 -R /tmp
user@host-$: chmod o+t -R /tmp
user@host-$: gem install passenger
user@host-$: passenger-install-nginx-module

The first 2 commands are the corteusy of this answer ( Getting remove_entry_secure error while using ruby application ) 前2个命令是此答案的补充( 使用ruby应用程序时出现remove_entry_secure错误

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

相关问题 Rails 4.1.6 APP:NGINX:目录索引“ / var / www / your_own_store / current / public /”被禁止 - Rails 4.1.6 APP: NGINX: directory index of “/var/www/your_own_store/current/public/” is forbidden Nginx 403:目录索引“ / home / deploy / MyApp / current / public /”被禁止 - Nginx 403: directory index of “/home/deploy/MyApp/current/public/” is forbidden nginx错误/ home / deploy / myapp / current / public /“被禁止 - nginx error /home/deploy/myapp/current/public/" is forbidden “...”的目录索引被禁止 - directory index of "..." is forbidden 在Ruby on Rails中,Options指令禁止目录索引 - Directory index forbidden by Options directive in ruby on rails Carrierwave + Nginx-提供公共目录中的图像 - Carrierwave + Nginx - Serving images from public directory Rails 4中的nginx 403禁止错误(无index.html文件) - nginx 403 forbidden error in Rails 4 (with no index.html file) 选项指令禁止的目录索引错误仅适用于ruby 1.8.7应用程序 - Directory index forbidden by Options directive error only for ruby 1.8.7 application 机架:/ var / app / current:Elastic beanstalk上没有这样的文件或目录 - Rack: /var/app/current: No such file or directory on Elastic beanstalk 我的/ public目录可以是rails 3 + passenger 3 + nginx 0.8的符号链接吗? - Can my /public directory be a symlink with rails 3 + passenger 3 + nginx 0.8?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM