【发布时间】:2012-03-21 15:30:26
【问题描述】:
我在 apache2.conf 的末尾添加了:
LoadModule passenger_module /home/rusik/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.11/ext/apache2/mod_passenger.so
PassengerRoot /home/rusik/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.11
PassengerRuby /home/rusik/.rvm/wrappers/ruby-1.9.2-p290/ruby
ServerName localhost
<VirtualHost *:80>
ServerName sample.app
DocumentRoot /home/rusik/work/ruby/sample_app/public
</VirtualHost>
所以,当我重新启动 apache 时
sudo apachectl restart
我得到了默认的 apache 页面,而不是 rails 项目的默认页面,为什么? The default file 在 /etc/apache2/sites-enabled/000-default 中,我没有更改的默认虚拟主机在哪里。
【问题讨论】:
-
你在浏览器中输入了什么网址?它需要匹配您的 virtualHost 块中的 ServerName(或别名),否则默认的将优先。
-
我正在输入“localhost”
-
如果我将在 VirtualHost 块中的 ServerName 之后添加 ServerAlias sample2.app 并将 sample2.app 放在浏览器中,它将无法工作。我试过了))
-
有你添加的 sample2.app 给你 /etc/hosts 吗?
-
好的..我添加了(127.0.0.1 sample2.app),重新启动,现在我看到:403 禁止您无权访问此服务器上的 /。在日志 apache "..unable to check htaccess file, ensure it is readable .." 中。我尝试 sudo chmod 777 /home/rusik/work/.htaccess 但错误是相同的 - 403 。 .htaccess 在 chmod 之后为空,但在之前,它不存在。
标签: ruby-on-rails ruby-on-rails-3 apache ruby-on-rails-3.1 passenger