1

I am using CentOS 6.6 first time to deploy Rails 4 application. I have installed all necessary softwares like MySQL, Ruby, Rails, Passenger, Apache2, etc. I have tested it for index.html page inside /var/www/html/index.html and set it on Apache configuration and working perfect.

When I deployed Rails application it did run on the server but it displayed as shown in screenshot below.

enter image description here

Below are my Apache configuration settings which I have done so far.

/etc/httpd/conf/httpd.conf

  LoadModule passenger_module /home/user/.rvm/gems/ruby-2.1.2/gems/passenger-5.0.6/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
    PassengerDefaultRuby /home/user/.rvm/wrappers/ruby-2.1.2/ruby
    PassengerRoot /home/user/.rvm/gems/ruby-2.1.2/gems/passenger-5.0.6
</IfModule>

I have created a file vhost.conf inside /etc/httpd/conf.d/

<VirtualHost *:80>
  ServerName myipaddress
  DocumentRoot /var/www/html/projectname/public_html/current/public
  <Directory /var/www/html/projectname/public_html/current/public>
     # This relaxes Apache security settings.
     AllowOverride all
     # MultiViews must be turned off.
     Options -MultiViews
     # Uncomment this if you're on Apache >= 2.4:
     #Require all granted
  </Directory>

I run the command below command

service httpd restart 
service httpd reload

Neither Rails app running in server nor showing any erros.

Any solution would be appreciated. Thanks in advance.

mins
  • 6,478
  • 12
  • 56
  • 75
siv rj
  • 1,451
  • 1
  • 14
  • 31

1 Answers1

1

First and always check the Apache logs. This step is essential, but often overlooked. If that doesn't help, I would try a few things:

Double-check the documentation and make sure you've completely installed Passenger, and haven't skipped a step.

Start by removing the IfModule directive. Since you want Passenger, you want an error message if it isn't loading.

LoadModule passenger_module /home/user/.rvm/gems/ruby-2.1.2/gems/passenger-5.0.6/buildout/apache2/mod_passenger.so
PassengerDefaultRuby /home/user/.rvm/wrappers/ruby-2.1.2/ruby
PassengerRoot /home/user/.rvm/gems/ruby-2.1.2/gems/passenger-5.0.6

You have your IP address as your server name. Make sure this doesn't conflict with any other configurations (other sites, or httpd.conf). Otherwise, you may just be loading a different page / application.

Depending on how you have it set up, you may have permissions issues since you're pointing PassengerDefaultRuby and PassengerRoot to /home/user/.rvm. By convention, these are usually somewhere more public like /var/lib/gems/ and /usr/bin/.

Make sure you have defined a root path in your Rails application's config/routes.rb.

Make sure you've chown -R-ed your application path to the apache user. This will help you with troubleshooting and security.

After you've done all that, check the logs again. After you make a change, check the logs again.

Travis
  • 1,463
  • 11
  • 12
  • Thanks for your answer. Yea you were right some permission issue was there. I installed everything again as root user and worked for me. – siv rj Apr 23 '15 at 15:05