Apache2 virtualhosts oh god
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
-James
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.
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.
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
@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.