directory index of "/sites/mysite.com/public/" is forbidden <=== error is driving me nuts

2,790 views
Skip to first unread message

mrmanishs

unread,
May 21, 2009, 1:23:39 PM5/21/09
to Phusion Passenger Discussions
So, I'm getting the error in the subject:

directory index of "/sites/mysite.com/public/" is forbidden using
nginx/passenger. I've looked around, and followed some of the advice,
including changing permissions to 755, but still getting this error.
Does anyone have any idea? This is my server config in nginx:

server {
listen 80;
server_name www.mysite.com;
root /sites/mysite.com/public;
passenger_enabled on;
access_log logs/mysite.access.log main;

# Main location
location / {

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;

client_max_body_size 10m;
client_body_buffer_size 128k;

proxy_connect_timeout 14400;
proxy_send_timeout 14400;
proxy_read_timeout 14400;

proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}

}

lardawge

unread,
May 22, 2009, 5:59:43 PM5/22/09
to Phusion Passenger Discussions
Take out the location block... None of that stuff needs to be in one
anyway.

richard

unread,
Jul 5, 2009, 7:55:51 PM7/5/09
to Phusion Passenger Discussions
Thank You!

Not sure why just commenting out the internals of the location block
wouldn't work - had to comment out opening and closing of the location
block.

Hongli Lai

unread,
Jul 6, 2009, 4:03:51 AM7/6/09
to phusion-...@googlegroups.com
On Mon, Jul 6, 2009 at 1:55 AM, richard<ran13...@gmail.com> wrote:
>
> Thank You!
>
> Not sure why just commenting out the internals of the location block
> wouldn't work - had to comment out opening and closing of the location
> block.

If you specify a location block then you must re-specify
"passenger_enabled on" inside it.


--
Phusion | The Computer Science Company

Web: http://www.phusion.nl/
E-mail: in...@phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)

Brian Hechinger

unread,
Jun 9, 2015, 8:38:16 PM6/9/15
to phusion-...@googlegroups.com, mrma...@gmail.com
So I'm fighting exactly this myself now and it's extremely frustrating.

I've got:

server {
  listen *:80;
  server_name           appserver.example.com;

  set $maintenance "off";
  if ($maintenance = "on") {
      return 503;
  }
  index  index.html index.htm index.php;

  access_log            /var/log/nginx/appserver.example.com.access.log combined;
  error_log             /var/log/nginx/appserver.example.com.error.log;

  location / {
    root      /var/www/apps/;
  }

  location ~ ^/flask_passenger(/.*|$). {
    alias /var/www/apps/flask_passenger/public$1;
    passenger_app_root /var/www/apps/flask_passenger;
    passenger_base_uri /flask_passenger;
    passenger_document_root /var/www/apps/flask_passenger/public;
    passenger_enabled on;
    passenger_python /usr/bin/python3;
  }
  passenger_enabled on;
  passenger_ruby /usr/bin/ruby2.0;
}

And I keep getting this error:

2015/06/03 14:56:26 [error] 1283#0: *1 directory index of "/var/www/apps/flask_passenger/" is forbidden, client: 10.42.99.9, server: appserver.example.com, request: "GET /flask_passenger/ HTTP/1.1", host: "appserver.example.com"

No matter what I do I can't seem to make this work and it's extremely frustrating.

I do not see any other passenger errors.

Oh, something I should add, I'm attempting to set this up (python) with 5.x non-enterprise and I'm attempting to setup geminabox using 4.x enterprise and I'm getting exactly the same thing in both places.

The super annoying part is we have running app servers on the 4.x branch with the SAME EXACT nginx config as the new one I'm attempting to setup that work just fine.

-brian

Daniel Knoppel

unread,
Jun 10, 2015, 8:25:17 AM6/10/15
to phusion-...@googlegroups.com, mrma...@gmail.com
Maybe a silly suggestion, but is Passenger actually able to recognize your app, i.e. does it have a passenger_wsgi.py file in the app root, as well as public/ and tmp/ folders?

- Daniel

Brian Hechinger

unread,
Jun 10, 2015, 8:36:57 AM6/10/15
to phusion-...@googlegroups.com, mrma...@gmail.com
Unfortunately it does have all those things. :)


-brian

Daniel Knoppel

unread,
Jun 10, 2015, 9:07:59 AM6/10/15
to phusion-...@googlegroups.com, mrma...@gmail.com
Yeah, that's correct. The only difference I noticed was that you have an extra dot after the location, but not sure off the top of my head what difference that would make.

And you also verified that the entire path to the app (/var/www/apps/flask_passenger/public) is accessible to the user that passenger is running as? I mean all those dirs are readable + executable etc.?

Has the app itself worked on a passenger setup before? Maybe try it without the suburi config if that's possible?

- Daniel

Brian Hechinger

unread,
Jun 10, 2015, 2:36:07 PM6/10/15
to phusion-...@googlegroups.com, mrma...@gmail.com
D'Oh!!!

That extra dot was EXACTLY the issue!!

That's the end of sentence marker and shouldn't be part of the location. That document could probably be updated to be more clear.

Now I get passenger errors.

Which is MUCH better than before. :)

THANK YOU!!!!!

-brian

Brian Hechinger

unread,
Jun 10, 2015, 10:16:14 PM6/10/15
to phusion-...@googlegroups.com, mrma...@gmail.com
Ok, so. Got that all sorted. The geminabox on 4.x enterprise is still not going well. I'm not doing Sub-URI there, so it's not the same issue. :(

2015/06/10 17:41:08 [error] 13355#0: *22 "/etc/gemininabox/public/index.html" is not found (2: No such file or directory), client: 192.168.199.210, server: gems.example.com, request: "GET / HTTP/1.1", host: "gems.example.com"

server {
  listen                *:80;

  server_name           gems.example.com;

    index  index.html index.htm index.php;

  access_log            /var/log/nginx/gems.example.com.access.log;
  error_log             /var/log/nginx/gems.example.com.error.log;

  location / {

    root  /etc/gemininabox/public;
  }
  passenger_enabled on;
  passenger_ruby /usr/bin/ruby2.2;
}

I'm not getting any passenger errors, just that nginx error.

-brian

Brian Hechinger

unread,
Jun 10, 2015, 10:16:59 PM6/10/15
to phusion-...@googlegroups.com, mrma...@gmail.com
Oh, also:

root@inf-cmhf-proxy-01:/var/log/nginx# ls -l /etc/geminabox/
total 12
lrwxrwxrwx 1 root      root        12 Jun  6 18:57 config.ru -> geminabox.ru
-rw-r--r-- 1 geminabox geminabox  174 Jun  2 19:30 geminabox.ru
drwxr-xr-x 2 root      root      4096 Jun  6 18:57 public
drwxr-xr-x 2 root      root      4096 Jun  6 18:57 tmp
root@inf-cmhf-proxy-01:/var/log/nginx#

Daniel Knoppel

unread,
Jun 11, 2015, 3:31:22 AM6/11/15
to phusion-...@googlegroups.com, mrma...@gmail.com
Try moving the (nginx) root line outside of the location (to the server level). If you don't want that, then I think you need to re-specify passenger_enabled on; inside the location block.

- Daniel

Brian Hechinger

unread,
Jun 11, 2015, 9:52:10 PM6/11/15
to phusion-...@googlegroups.com, mrma...@gmail.com
I've tried removing the location block completely leaving just the root. I've also tried putting the passenger_enable in the location block.

Neither have changed the behavior at all. :(

-brian

Daniel Knoppel

unread,
Jun 12, 2015, 5:12:22 AM6/12/15
to phusion-...@googlegroups.com, mrma...@gmail.com
Well, I assumed you didn't paste the entire config since you got the previous one working while it was missing the most important line, the passenger_root. But maybe that's the problem still.

- Daniel

Brian Hechinger

unread,
Jun 12, 2015, 8:59:22 AM6/12/15
to phusion-...@googlegroups.com, mrma...@gmail.com
I'm using the jfryman/nginx puppet module to set this all up which puts passenger_root into the main nginx.conf. I'm just showing the site files. I can paste the entire thing. Allow me to do so.

root@inf-cmhf-proxy-01:/etc/nginx# cat nginx.conf
user www-data;
worker_processes 1;
worker_rlimit_nofile 1024;
error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;

events {
  worker_connections 1024;
    }

http {
  include       /etc/nginx/mime.types;
  default_type  application/octet-stream;

  access_log  /var/log/nginx/access.log;

  sendfile    on;

  server_tokens on;

  types_hash_max_size 1024;
  types_hash_bucket_size 512;

  server_names_hash_bucket_size 64;
  server_names_hash_max_size 512;

  keepalive_timeout  65;
  tcp_nodelay        on;

  gzip         on;
  gzip_disable "MSIE [1-6]\.(?!.*SV1)";



  passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;

  include /etc/nginx/conf.d/*.conf;
  include /etc/nginx/sites-enabled/*;

}

root@inf-cmhf-proxy-01:/etc/nginx# cat sites-enabled/gems.example.com.conf
server {
  listen                *:80;

  server_name           gems.example.com;

    index  index.html index.htm index.php;

  access_log            /var/log/nginx/gems.example.com.access.log;
  error_log             /var/log/nginx/gems.example.com.error.log;

#  location / {

    root  /etc/gemininabox/public;
#    passenger_enabled on;
#    passenger_ruby /usr/bin/ruby2.2;
#  }
  passenger_enabled on;
  passenger_ruby /usr/bin/ruby2.2;
}

Daniel Knoppel

unread,
Jun 12, 2015, 9:32:57 AM6/12/15
to phusion-...@googlegroups.com, mrma...@gmail.com
Oh, I didn't notice before but it looks like another spelling error ;)

> root  /etc/gemininabox/public;
> ls -l /etc/geminabox/

- Daniel

Brian Hechinger

unread,
Jun 14, 2015, 10:07:56 PM6/14/15
to phusion-...@googlegroups.com, mrma...@gmail.com
I…

I…

I must now sell all my computers and become a garbage collector.

Thanks. :)

-brian

-- 
You received this message because you are subscribed to a topic in the Google Groups "Phusion Passenger Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/phusion-passenger/FA4S3Ulgijs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to phusion-passen...@googlegroups.com.
To post to this group, send email to phusion-...@googlegroups.com.
Visit this group at http://groups.google.com/group/phusion-passenger.
To view this discussion on the web visit https://groups.google.com/d/msgid/phusion-passenger/5d9668f6-e28e-46c4-a248-20cb2d645248%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages