我正在为我的 cent OS 服务器 5.8 上的 rails 应用程序设置虚拟主机而苦苦挣扎。我已经安装了 apache 即 httpd。
然后使用gem install passneger
.
安装工作正常。
passenger-install-apache2-module
然后使用命令为乘客安装 apache 模块。
然后编辑 /etc/httpd/conf/httpd.conf
并添加以下行来设置我的 virtulhost
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.8.7-p160/gems/passenger-3.0.17/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-1.8.7-p160/gems/passenger-3.0.17
PassengerRuby /usr/local/rvm/wrappers/ruby-1.8.7-p160/ruby
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
RailsEnv development
DocumentRoot /var/www/college/public
ServerName dummy-host.example.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
<directory /var/www/college/public>
AllowOverride all
Options -MultiViews
</directory>
</VirtualHost>
# chown -R apache.apache *
使用命令将项目的所有者更改为 apache
现在我在我的应用程序“学院”中为“学生”创建了一个脚手架。但是public/index
显示模型的rails environment details
页面和索引页面都没有student
工作。请指导我究竟出了什么问题,因为我是这些服务器配置的新手。谢谢!
更新: 我从公共目录中删除了索引页面并使用 home 方法创建了一个控制器页面。然后我设置了 root :to => 'pages#home'
现在当我检查它的日志时dummy-host.example.com-error_log
显示
Directory index forbidden by Options directive: /var/www/college/public/
当我跟踪日志时,/var/log/httpd/error_log
它显示
[notice] caught SIGTERM, shutting down
[notice] SELinux policy enabled; httpd running as context root:system_r:httpd_t:s0
[notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[error] *** Passenger could not be initialized because of this error: Cannot create FIFO file /tmp/passenger.3469/.guard: Permission denied (13)
[warn] module passenger_module is already loaded, skipping
[notice] Digest: generating secret for digest authentication ...
[notice] Digest: done
[error] *** Passenger could not be initialized because of this error: Cannot create FIFO file /tmp/passenger.3471/.guard: Permission denied (13)
[notice] Apache/2.2.3 (CentOS) configured -- resuming normal operations
现在有人请告诉我出了什么问题?
UPDATE2 现在我遵循下面提到的答案。现在出现以下错误
[notice] SELinux policy enabled; httpd running as context root:system_r:httpd_t:s0
[notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[error] *** Passenger could not be initialized because of this error: The Passenger spawn server script, '/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.15/lib/phusion_passenger/passenger-spawn-server', does not exist. Please check whether the 'PassengerRoot' option is specified correctly.
[warn] module passenger_module is already loaded, skipping
[notice] Digest: generating secret for digest authentication ...
[notice] Digest: done
[error] *** Passenger could not be initialized because of this error: The Passenger spawn server script, '/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.15/lib/phusion_passenger/passenger-spawn-server', does not exist. Please check whether the 'PassengerRoot' option is specified correctly.
[notice] Apache/2.2.3 (CentOS) configured -- resuming normal operations
现在我的乘客安装成功了,那是什么问题?