[英]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. 当我尝试访问在Nginx和passenger之上运行的rails应用程序时,我得到了403。 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. 即使当我以root用户身份运行nginx时,也会出现此问题,因此我认为这不是权限问题。 I think the problem is that I do not have
passenger_ruby
or passenger_root
defined in my nginx.conf file. 我认为问题在于我的nginx.conf文件中没有定义
passenger_ruby
或passenger_root
。 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. 您可以看到我尝试过的注释掉的passenger_root和passenger_ruby版本。 When I uncomment these, nginx fails to start but does not produce any error messages.
当我取消注释时,nginx无法启动,但不会产生任何错误消息。
您可以检查乘客的安装与道路passenger-config --root
和Ruby安装使用的路径which ruby
。
To find path for passenger_root: 要查找passenger_root的路径:
$ passenger-config --root $ passenger-config --root
To find path for passenger_ruby, run the below and you see passenger_ruby path 要找到passenger_ruby的路径,请运行以下命令,您会看到passenger_ruby路径
$ passenger-config --ruby-command $ 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.
检查您的目录和文件权限,以便您的Web服务器可以读取它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.