Apache2 question

Alex Dean alex at crackpot.org
Mon Nov 14 10:27:48 MST 2005


On Nov 14, 2005, at 9:55 AM, Miles Beck wrote:
> At the end of apache2.conf was the following line.
>
> # Include the virtual host configurations:
> Include /etc/apache2/sites-enabled/[^.#]*


Ooops, that slipped my mind.  (The first thing I did when I set up my  
server was disable the '000-default' domain.)

If you ever want to serve multiple sites from this server, you're  
better off using a subdirectory of /var/www as the document root,  
rather than /var/www itself.  I use a different directory for each  
site, and use the site's name for the directory name.

/var/www/site1.org/
/var/www/site2.com/
/var/www/site3.net/

All the files in 'sites-enabled' are really symbolic links to actual  
files in /etc/apache2/sites-available.  You can use 000-default  
config file as a base for your first site configuration.  Name the  
config file after your site to keep track of which is which.  'cp 000- 
default site1.org'.  Now you can set up the configuration for your  
first site in this file.  When you want to make it live, you can run  
the 'a2ensite' script to link your config file into 'sites-enabled'.   
(You can later do 'a2dissite' to take it offline for whatever reason.)

This might seem needlessly complex if you're just doing this for the  
first time, but doing this way will mean you can add an unlimited  
number of sites to your server without having to rearrange what  
you've already set up.  Again, I think the Apache Cookbook is pure  
gold for getting the hang of this stuff.

alex



More information about the PLUG-discuss mailing list