Problem with Hosting multiple rails applications on Ubuntu

Hello,

I am trying to host 2 different rails applications on Linode. Here are the details.

1) First app is www.eyesandfeet.com

2) Second app is www.use.eyesandfeet.com

I have followed the same procedure that listed in the tutorial,

http://library.linode.com/web-servers/a … al_hosting">http://library.linode.com/web-servers/apache/installation/ubuntu-9.04-jaunty#configureapachefornamedbasedvirtualhosting

So here is my apache config,

File excerpt: /etc/apache2/sites-available/eyesandfeet.com

ServerAdmin [email protected]

ServerName eyesandfeet.com

ServerAlias www.eyesandfeet.com

DocumentRoot /srv/www/eyesandfeet.com/eyesandfeet/public

ErrorLog /srv/www/eyesandfeet.com/logs/error.log

CustomLog /srv/www/eyesandfeet.com/logs/access.log combined

File excerpt: /etc/apache2/sites-available/use.eyesandfeet.com

ServerAdmin [email protected]

ServerName use.eyesandfeet.com

ServerAlias www.use.eyesandfeet.com

DocumentRoot /srv/www/use.eyesandfeet.com/eyesandfeet/public

ErrorLog /srv/www/use.eyesandfeet.com/logs/error.log

CustomLog /srv/www/use.eyesandfeet.com/logs/access.log combined

Then I have enabled both the sites and reloaded the apache.

I have placed the 2 rails applications in the respective folders as follows.

/srv/www/eyesandfeet.com/eyesandfeet

/srv/www/use.eyesandfeet.com/eyesandfeet

I have created 2 DNS entires for eyesandfeet.com and use.eyesandfeet.com..

When I point to www.use.eyesandfeet.com, it points to www.eyesandfeet.com.

But it supposed to go to the other application.

I have the same problem since 3days. Any help will be much appreciated.

Thanks,

Muni.

5 Replies

You're supposed to use a host, not an IP in the VirtualHost directive. See the apache docs.

Can you please give an example? Please never mind..

@Ævar Arnfjörð Bjarmason:

You're supposed to use a host, not an IP in the VirtualHost directive. See the apache docs.

@Ævar Arnfjörð Bjarmason:

You're supposed to use a host, not an IP in the VirtualHost directive. See the apache docs.
This is incorrect - you have it backwards. See the apache docs. :wink:

http://httpd.apache.org/docs/2.0/mod/co … irtualhost">http://httpd.apache.org/docs/2.0/mod/core.html#virtualhost

muni, I don't know that this will correct your problem, but I did notice you are missing the "Directory" directive. For example:

 <virtualhost 69.164.207.220:80="">ServerAdmin [email protected]
        ServerName eyesandfeet.com
        ServerAlias www.eyesandfeet.com
        DocumentRoot /srv/www/eyesandfeet.com/eyesandfeet/public
        ErrorLog /srv/www/eyesandfeet.com/logs/error.log
        CustomLog /srv/www/eyesandfeet.com/logs/access.log combined

        <directory "="" srv="" www="" eyesandfeet.com="" eyesandfeet="" public"="">Options Indexes +ExecCGI FollowSymLinks 
                Order allow,deny
                Allow from all</directory> 

 <virtualhost 69.164.207.220:80="">ServerAdmin [email protected]
        ServerName use.eyesandfeet.com
        ServerAlias www.use.eyesandfeet.com
        DocumentRoot /srv/www/use.eyesandfeet.com/eyesandfeet/public
        ErrorLog /srv/www/use.eyesandfeet.com/logs/error.log
        CustomLog /srv/www/use.eyesandfeet.com/logs/access.log combined

        <directory "="" srv="" www="" use.eyesandfeet.com="" eyesandfeet="" public"="">Options Indexes +ExecCGI FollowSymLinks 
                Order allow,deny
                Allow from all</directory></virtualhost></virtualhost> 

@BrianJM:

@Ævar Arnfjörð Bjarmason:

You're supposed to use a host, not an IP in the VirtualHost directive. See the apache docs.
This is incorrect - you have it backwards. See the apache docs. :wink:

http://httpd.apache.org/docs/2.0/mod/co … irtualhost">http://httpd.apache.org/docs/2.0/mod/core.html#virtualhost

Yeah, I stand corrected. I shouldn't post so early in the morning. Anyway, i can't see anything wrong with the configuration file then.

But it's possible to find this out via Apache, e.g. by checking in the logs what vhosts it things it's serving for specific requests.

Hello Guys,

Thanks for all your help. The problem was with the config file.. I was supposed to do the NameVirtualHost but was doing the IP Based Virtual Hosting..

So after modifying the config files it looks like this..

ServerAdmin [email protected]

ServerName use.eyesandfeet.com

ServerAlias www.use.eyesandfeet.com

DocumentRoot /srv/www/use.eyesandfeet.com/eyesandfeet/public

ErrorLog /srv/www/use.eyesandfeet.com/logs/error.log

CustomLog /srv/www/use.eyesandfeet.com/logs/access.log combined

same thing for eyesandfeet.com also..

And then I have added the line "NameVirtualHost *" in the apache2.conf file..

I have disabled the sites and loaded the apache and then restarted the apache….

Thats all.. Both the things works now as it is supposed to work..

Once again thanks for all your help..

Thanks,

Muni.

@Ævar Arnfjörð Bjarmason:

@BrianJM:

@Ævar Arnfjörð Bjarmason:

You're supposed to use a host, not an IP in the VirtualHost directive. See the apache docs.
This is incorrect - you have it backwards. See the apache docs. :wink:

http://httpd.apache.org/docs/2.0/mod/co … irtualhost">http://httpd.apache.org/docs/2.0/mod/core.html#virtualhost

Yeah, I stand corrected. I shouldn't post so early in the morning. Anyway, i can't see anything wrong with the configuration file then.

But it's possible to find this out via Apache, e.g. by checking in the logs what vhosts it things it's serving for specific requests.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct