I’m trying to set up two web sites on my Apache2 server using virtual hosting. I created DNS domain zones for both sites. When I point my browser to either domain name, I get the Apache2 default index.html file.
I want to get one site set up correctly, then add the second one. I
I looked at several online tutorials, and finally settled on the approach described at:
http://www.debian-administration.org/articles/412 :
I’m running Debian Etch. I’ll create both sites in the /var/www/ directory. The first domain name is bookgenius.org, so I created these directories:
/var/www/bookgenius.com/html
/var/www/bookgenius.com/hcgi-bin
/var/www/bookgenius.com/logs
I opened the file /etc/apache2/sites-available/default
and commented out the first line containing
NameVirtualHost *
(This was per the advice of the tutorial, which notes that when apache starts up, it reads the contents of all files included in /etc/apache2/conf.d.
Next, I created a virtual.conf file in /etc/apache2/conf.d/
containing just the line:
NameVirtualHost *
Then I created a file called /etc/apache2/sites-available/bookgenius.org containing the following:
#########################################
<VirtualHost *:80>
# Admin email, Server Name (domain name) and any aliases
ServerAdmin
morgan@acm.org
ServerName bookgenius.org
ServerAlias
www.bookgenius.org
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html
DocumentRoot /var/www/bookgenius.org/html/
# CGI Directory
ScriptAlias /cgi-bin/ /var/www/bookgenius.org/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>
# Custom log file locations
LogLevel warn
ErrorLog /var/www/bookgenius.org/logs/error.log
CustomLog /var/www/bookgenius.org/logs/access.log combined
</VirtualHost>
##########################################
Lastly, I typed:
a2ensite bookgenius.org
and got:
Site bookgenius.org installed; run /etc/init.d/apache2 reload to enable.
I reloaded Apache, but the browser still points to the default Apache index.html page instead of the new index.html page I put in the bookgenius.org/html directory.
Does anyone have any ideas about what I’m doing wrong?
Many thanks!
- Chris M.