简体   繁体   中英

403 Forbidden when using nginx + rails + passenger

I am getting a 403 when I try to access my rails app running on top of nginx and passenger. Here is the error from the log file:

2013/05/09 13:52:34 [error] 27787#0: *1 directory index of "/var/www/Tread-Forth/current/public/" is forbidden, client: 192.249.16.60, server: treadforth.com, request: "GET / \
HTTP/1.1", host: "www.treadforth.com"

This problem occurs even when I run nginx as root, so I don't think it is a permissions problem. I think the problem is that I do not have passenger_ruby or passenger_root defined in my nginx.conf file. The problem is, I don't know where these values go in the config file, and I don't know what their values should be. Any help would be great. Here is my conf file for reference:

worker_processes  1;

events {
    worker_connections  1024;
}


http {
    #passenger_root /usr/local/bin/passenger;
    #passenger_ruby /usr/local/bin/ruby;

    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;

    keepalive_timeout  65;

    server {
        listen       80;
        server_name  .treadforth.com;
        root /var/www/Tread-Forth/current/public;
        passenger_enabled on;
    }
}

You can see the commented out version of passenger_root and passenger_ruby I have tried. When I uncomment these, nginx fails to start but does not produce any error messages.

您可以检查乘客的安装与道路passenger-config --root和Ruby安装使用的路径which ruby

To find path for passenger_root:
$ passenger-config --root

To find path for passenger_ruby, run the below and you see passenger_ruby path
$ passenger-config --ruby-command

Forbidden means that you have a permission problem. Check your directory and file permissions so that they are readable by your webserver.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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