Apache on Debian Squeeze Notes

Apache Directory:

# ls /etc/apache2
apache2.conf  envvars	  magic		  mods-enabled	sites-available
conf.d	      httpd.conf  mods-available  ports.conf	sites-enabled

Content is placed in sites-available and is made live by creating a link to it in sites-enabled.

Restart Apache:

/etc/init.d/apache2 restart
Apache Name-based Virtual Hosts on Debian Squeeze

Name-based virtual hosting allows multiple hosts to share the same IP address.

Enabling name-based virtual hosts

Name-based virtual hosting is enabled for each IP address and port in /etc/apache2/ports.conf

NameVirtualHost *:80
Listen 80

You could also create a file in /etc/apache2/conf.d as Apache reads all files in here on startup.

Configuring virtual hosts

Create a file for each in /etc/apache2/sites-available and enable them by...

For example /etc/apache2/sites-available/alasdairsmith.com

<VirtualHost *:80>
    ServerName alasdairsmith.com
    ServerAlias www.alasdairsmith.com
    DocumentRoot /var/www/alasdairsmith.com/public_html/

Enabling and disabling sites

Sites are enabled by creating a symbolic link in sites-enabled/ to the file in sites-available/. The Debian Apache package provides two utilities a2ensite and a2dissite to do this for you.

Reload or restart Apache

Reload /etc/init.d/apache2 reload or restart /etc/init.d/apache2 restart Apache for the changes to take effect


Your email address will not be published. I need it to send you a verification link. It will also be sent to Gravatar to check if you have one.

Alasdair Smith

Just a test comment.

Alasdair Smith

Another test.

Alasdair Smith

Yet another test.

Alasdair Smith

Fourth time lucky?

Alasdair Smith

Fifth time?

Alasdair Smith

Please work this time.

Alasdair Smith

Once again.

Alasdair Smith

One more time!

Alasdair Smith

Just another test.

Add your own comment?