3

在过去的一个小时里,我浏览了 100 多个链接,但没有任何帮助。我想做的很简单:使用passenger 在apache 上部署一个rails 应用程序。我遇到的问题是 403 Forbidden 错误。我的设置:

我运行这两个命令:

sudo gem install passenger
rvmsudo passenger-install-apache2-module

然后在etc/apache2/other我创建一个名为的文件Passenger.conf

LoadModule passenger_module /Users/maq/.rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.14/buildout/apache2/mod_passenger.so
PassengerRoot /Users/maq/.rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.14
PassengerDefaultRuby /Users/maq/.rvm/wrappers/ruby-2.0.0-p247/ruby

然后在 中/etc/apache2/extra/httpd-vhosts.conf,我有:

<VirtualHost *:80>
   ServerName rails.local
   DocumentRoot /webapps/coolapp/public
   <Directory /webapps/coolapp/public/>
      AllowOverride all
      Allow from all
      Options -MultiViews
   </Directory>
</VirtualHost>

然后在我的/etc/hosts文件中,添加以下条目:

127.0.0.1 rails.local

然后,我更改webapps目录的权限:

sudo chmod -R 755 /webapps

然后我重新启动 Apache:

sudo apachectl restart

这些都不能解决问题。当我在浏览器中访问 rails.local 时,我不断得到同样的结果:

您无权访问此服务器上的 /。Apache/2.2.22 (Unix) DAV/2 Phusion_Passenger/4.0.14 mod_ssl/2.2.22 OpenSSL/0.9.8x 服务器位于 rails.local 端口 80

看在上帝的份上的人告诉我问题可能是什么。

4

1 回答 1

0

Apache won't have permission to access /. You should be serving up your websites from /Library/WebServer/Documents/ or—depending on what group Apache is configured to run under (wheel by default in OS X)—you can try sudo chown -R root:wheel /webapps

Edit

My httpd.conf configuration has the following user/group:

User: [my user] # is an admin user
Group: staff
于 2013-09-04T17:59:28.940 回答