New VirtualHost takes control of DirectoryRoot

OK. I have been banging my head. This isn't the first time I have configured VirtualHosts but I have never come across this problem.

I have a single host on my newly setup linode.

pellacrosscountry.com
# domain: pellacrosscountry.com
# public: /var/www/pellacrosscountry.com/public_html/

 <virtualhost *:80=""># Admin email, Server Name (domain name), and any aliases
  ServerAdmin runrobrun@gmail.com
  ServerName pellcrosscountry.com
  ServerAlias www.pellacrosscountry.com
  ServerAlias pelladutchxc.com
  ServerAlias www.pelladutchxc.com

  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php
  DocumentRoot /var/www/pellacrosscountry.com/public_html/

  # Log file locations
  LogLevel warn
  ErrorLog  /var/www/pellacrosscountry.com/log/error.log
  CustomLog /var/www/pellacrosscountry.com/log/access.log combined</virtualhost> 

Works find and dandy.

I set up and enabled a second virtual host gatewaynazarene.org

# domain: gatewaynazarene.org
# public: /var/www/gatewaynazarene.org/public_html/

 <virtualhost *:80=""># Admin email, Server Name (domain name), and any aliases
  ServerAdmin runrobrun@gmail.com
  ServerName  gatewaynazarene.org
  ServerAlias www.gatewaynazarene.org

  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php
  DocumentRoot /var/www/gatewaynazarene.org/public_html/
  # Log file locations
  LogLevel warn
  ErrorLog  /var/www/gatewaynazarene.org/log/error.log
  CustomLog /var/www/gatewaynazarene.org/log/access.log combined</virtualhost> 

As soon as I make this change and enable the site then restart apache the original domain pellacrosscountry.com pulls up the html file stored in the gatewaynazarene.org DocumentRoot? I have dug through configurations in the apache2.conf that I can think of.

Any ideas? Interestingly enough if I enable a third site then pellacrosscountry.com points to that one. Probably something really stupid but I can't seem to get it figured out.

Rob

4 Replies

Why that particular site? The config files are loaded in alphabetical order by filename, and I bet gatewaynazarene.org is sorting before pellacrosscountry.com, so that's what gets loaded by default.

Why is it falling back to the default? Double-check your spelling on the ServerName line for pellacrosscountry.com… doh!

Well…this is embarrassing. I knew it was something stupid like that I just couldn't see it. Thanks for being my second pair of eyes, hoopycat! I will try not to pollute this space with such silly issues.

Don't sweat it!! It was simple, and now you probably know why it didn't manifest itself before. Best part is that you posted enough information that I could actually spot the problem. :-)

As penance, you owe me a dutch letter.

@runrobrun:

Well…this is embarrassing. I knew it was something stupid like that I just couldn't see it. Thanks for being my second pair of eyes, hoopycat! I will try not to pollute this space with such silly issues.

I had this happen to me last week :) drove me nuts until I went over the virtualhost config real well and saw that I was missing a letter, doh!

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