Apache2 virtualhosts oh god

I had this problem before and somehow managed to fix it. I wish I remembered how!

I have copied apache2.conf and all my sites-available files from another debian etch box to a fresh debian etch box on my linode.

apache starts fine, there are no errors, and all my domains go to default site :/. What?!

# domain: default.com
# public: /home/patrick/public_html/default/

 <virtualhost *=""># Admin email, Server Name (domain name) and any aliases
ServerAdmin webmaster@default.com
ServerName  default.com
ServerAlias www.default.com

# Index file and Document Root (where the public files are located
DirectoryIndex index.html index.php
DocumentRoot /home/patrick/public_html/default/public

 <directory "="" home="" patrick="" public_html="" default="" public"="">AllowOverride All</directory> 

# Custom log file locations
ErrorLog  /home/patrick/public_html/default/logs/error.log
CustomLog /home/patrick/public_html/default/logs/access.log combined</virtualhost> 

All the other vhosts are much the same except for having the domain name/directory changed. This worked on the other server with the same apache2.conf, so what gives?! I don't doubt it is something very simple!

The old server was a slicehost box, if that is any sort of hint to a solution?

Thank you!

7 Replies

Do you have a NameVirtualHost somewhere in your configuration?

-James

In addition to copying the contents of sites-available, did you run a2ensite on those sites (or copy the links)?

As I expected, it was just me being a moron.

I had a file in /etc/apache2/conf.d with just NameVirtualHost * in it which I forgot to copy over.

For some reason if I put that line in apache2.conf it throws an error, but it doesn't mind it in a separate file like that. Who knows.

I have updated to Debian Lenny.

When apache2 starts, it now says:

[warn] NameVirtualHost *:80 has no VirtualHosts

Which is odd, as I have not changed anything in the config files. The server works though, every site comes up as it should.

The end of my apache2.conf:

# Include generic snippets of statements
Include /etc/apache2/conf.d/

# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/

In /etc/apache2/conf.d/virtual:

#
#  We're running multiple virtual hosts.
#
NameVirtualHost *

All of my sites vhost files look much like the example in the original post.

Did you happen across the section titled "Upgrading Apache2" in the release notes?

http://www.debian.org/releases/lenny/i3 … ml#apache2">http://www.debian.org/releases/lenny/i386/release-notes/ch-information.en.html#apache2

I had changed all my sites under site-available to *:80. I just now changed the line in /etc/apache2/conf.d/virtualhosts to read NameVirtualHost *:80.

I also had let the update overwrite my apache2 config file. The only change I had made to it was adding ServerName.

Anyway, error is still there. I wish it would output a line number and exactly which config file it is mad at.

In other news, I managed to get SSL working on a single virtual host :o.

@patrick:

I had changed all my sites under site-available to *:80. I just now changed the line in /etc/apache2/conf.d/virtualhosts to read NameVirtualHost *:80.
Don't feel bad, same thing happened to me when I switched over from Slicehost. :-) I figured it out pretty quickly, but it was still a bit of a pain.

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