ruby-on-rails-3centosvirtualhostpassengerhttpd.conf

Set up Apache+passenger for my rails application on cent os 5.8


I am struggling with set up of virtual host for my rails app on my cent OS server 5.8. I have installed apache i.e httpd.

Then installed Passenger using gem install passenger.

The installation worked properly.

Then installed apache module for passenger using passenger-install-apache2-module command.

Then edited /etc/httpd/conf/httpd.conf & added following lines to set up my 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>

changed owner of the project to apache using # chown -R apache.apache * command

Now I have created a scaffold for 'student' in my app 'college'. But neither the public/index page showing the rails environment details nor the index page of student model working. Please guide me about what exactly going wrong as I am novice to these server configurations. Thank you!

UPDATE: I deleted the index page from public directory & created a controller pages with home method. Then I have set root :to => 'pages#home'

Now when I checked the logs of dummy-host.example.com-error_log it shows

Directory index forbidden by Options directive: /var/www/college/public/

and when I tailed the log from /var/log/httpd/error_log it shows

[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

Now somebody please tell me whats going wrong?

UPDATE2 Now I followed the answer mentioned below. And now getting following error

[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

Now my passenger installation was successful, then what's the issue?


Solution

  • Did you see this post https://stackoverflow.com/a/2429590/621354 ?

    I'm an ubuntu user but your "apache" user not is "www-data"?