A couple of months ago I set up a rails app using apache, passenger and virtualhost and I (eventually) got everything working fine. Now I am trying host another application on the same box. I've added the new virtual host (see below - app2), and edit my hosts file to point at the hosting IP (192.x.x.10), however when I enter app2.host.com I get app1. Also when I browse to http://192.x.x.10 I get app1 automatically. Is this normal?

My httpd.conf file looks like this:

LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-3.0.9/ext/apache2/mod_passenger.so
   PassengerRoot /var/lib/gems/1.8/gems/passenger-3.0.9
   PassengerRuby /usr/bin/ruby1.8

<VirtualHost *:80>
   ServerName app1.host.com
   DocumentRoot /var/www/app1/public
   <Directory /var/www/app1/public>
      AllowOverride all
     Options -MultiViews
   </Directory>

ErrorLog /var/log/apache2/error.log

</VirtualHost>


<VirtualHost *:80>
   ServerName app2.host.com
   DocumentRoot /var/www/app2/public
   <Directory /var/www/app2/public>
      AllowOverride all
      Options -MultiViews
   </Directory>

ErrorLog /var/log/apache2/error.log

</VirtualHost>

I've done a lot of research into this and everything I've seen seems to indicate that I am missing a NameVirtualHost *:80 But I have included this in my ports.conf file.

I really hope someone can help me out. I'm on a Ubuntu server.

Thanks in advance for any help you can offer.

link|improve this question
1  
Could you copy and paste output of this command : "cat /etc/apache2/apache2.conf && echo "###PORTS###" && echo /etc/apache2/ports.conf && echo "###SITES###" && cat /etc/apache2/sites-enabled/*" to pastebin.com and post the link here. – Andrey Nov 13 '11 at 0:23
1  
This is an apache misconfiguration: it is not identifying correctly the requests for each site, so it is serving the first site on httpd.conf. If you try to switch their order you will probably get app2. I had this problen before, I am going to check if I have the solution somewhere and get back to you – ooops Jan 3 at 14:27
feedback

1 Answer

Check the .htaccess of the second site, maybe it is overriding your vhost configuration and routing the web request to the previous site.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.