Bella
Bella

Reputation: 1

rails site showing index of / page

My Rails site used to work, but after starting over after doing an OS upgrade, it is now showing only the index of / with the contents of the rails app's public directory.

My PHP site is working fine, so this must be a configuration issue. I have looked at this problem for a long time, so I'm at a loss here. I really appreciate your help.

I followed the instructions on http://library.linode.com/frameworks/ruby-on-rails-apache/ubuntu-10.04-lucid as before.

I have the following setup in /etc/apache2/sites-availabe/mydomain.com:

<VirtualHost ip:80>
        ServerName mydomain.com
        DocumentRoot /srv/www/mydomain.com/app/public/
        ServerAlias www.mydomain.com
        ErrorLog /srv/www/mydomain.com/log/error.log
        CustomLog /srv/www/mydomain.com/log/access.log combined
</VirtualHost>

My app is under /srv/www/mydomain.com/app/. What is wrong here? This used to work before migration.

The app is on ubuntu 10.4.

Upvotes: 0

Views: 1213

Answers (4)

Bella
Bella

Reputation: 11

For future readers, I found the answer here: https://help.ubuntu.com/community/RubyOnRails#Installing%20rails

I had passenger gem installed.

What was missing was:

sudo apt-get install apache2-dev libapr1-dev libaprutil1-dev

Enable the passenger simply by typing:

a2enmod passenger

Then restart apache. Voila!

Upvotes: 1

Rilindo
Rilindo

Reputation: 1796

When you upgraded the OS, you also upgraded Apache. If you were using Passenger, you probably installed it by having it compiled it manually, so that got lost in the process of the upgrade. You may need to re-run through the installation of Passenger again.

Upvotes: 0

kylewelsby
kylewelsby

Reputation: 4109

I had many troubles starting out with vHosts. This little quick guide may help.

$ gem install passenger
$ passenger-install-apache2-module

Follow the screen instructions.

Edit your current vHost configuration.

<VirtualHost *:80>
  ServerName mydomain.com
  ServerAlias www.mydomain.com
  DocumentRoot "/srv/www/mydomain.com/app/public/"
  <Directory "/srv/www/mydomain.com/app/public/">
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

Restart your Apache server.

$ sudo apache graceful

Add the following to the end of your /etc/hosts file in your favorite editor.

127.0.0.1 mydomain.com www.mydomain.com

Test your domain.

$ ping mydomain.com

You should see something like

PING mydomain.com (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.035 ms

Now you should be able to go into your favorite browser and navigate to mydomain.com and see your application instance.

Upvotes: 6

Zach Inglis
Zach Inglis

Reputation: 1257

By the sounds of it you need to install Phusion Passenger? If you need any help check out Dan Benjamin's guide.

Upvotes: 0

Related Questions