Apache default server is showing virtual server directory

I have my Linode set up as hostname dotmil.org with several virtual servers for other domains. Before I added the virtual servers dotmil.org showed the /var/www directory for it's root, but now when I go to dotmil.org, it maps to the first virtual server's home/public_html instead. The only things that were changed on the httpd.conf was adding the virtual servers, any ideas on where to begin to fix this? Google, et. al. weren't much help.

My httpd.conf can be seen at this link. This is on a Debian Sarge installation too FWIW.

5 Replies

I've faced this before and know of one way to fix it. There might be a more "correct" way, but:

Since you're doing Name Based virtual hosts on the primary/single IP, you need to add dotmill as another , with a proper "ServerName" option.

-Chris

Thanks, that fixed it.

Just curious, I do have a second IP for my Linode (for DNS purposes), could I configure virtual servers on that IP as well? I'm assuming yes, but it would probably be with little or no purpose unless for SSL or something like that?

@dotmil:

curious, I do have a second IP for my Linode (for DNS purposes), could I configure virtual servers on that IP as well? I'm assuming yes, but it would probably be with little or no purpose unless for SSL or something like that?
You are exactly correct. SSL certs are the only thing that requires an additional IP for hosting…

-Chris

@caker:

I've faced this before and know of one way to fix it. There might be a more "correct" way, but:
caker's way is the correct way.

@apache docs:

If you are adding virtual hosts to an existing web server, you must also create a block for the existing host. The ServerName and DocumentRoot included in this virtual host should be the same as the global ServerName and DocumentRoot. List this virtual host first in the configuration file so that it will act as the default host.
Virtual host documentation

Thanks pclissolid; time to RTFM.

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