Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to add a new subdomain to an existing site. I'm using Apache on Debian, with a number of working virtual hosts on the site already - not set up by me.

The /etc/apache2/apache2.conf file contains the following lines (incidentally httpd.conf exists but is empty, I don't know if that's significant):

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

In the /etc/apache2/sites-enabled/ directory, there is a whole bunch of files, called things like

Each of these files has a VirtualHost entry - e.g. looks like this:

<VirtualHost *:80>
    WSGIScriptAlias /var/docs/forum.wsgi
    ... etc

My question is this. To add a new subdomain, do I simply need to create a new file in /etc/apache2/sites-enabled/ and set ServerName and WSGIScriptAlias appropriately? Or is there more to it than that?

share|improve this question

migrated from Aug 9 '10 at 16:45

This question came from our site for computer enthusiasts and power users.

if all you want is to add a subdomain to an existent site, for example if the site was you could open that file and add bellow ServerName the follow ServerAlias if ServerAlias already exist just go to the end of the line hit space and add the new subdomain, save and restart apache. – Prix Aug 9 '10 at 20:05

Yes, create a new file in /etc/apache2/sites-available, perhaps copying one of the previous files and modifying it. Then save (keeping to the already-present naming structure will probably help to keep things organised),


or whatever you've called the file will tell Apache to enable the site, automatically creating the symlink needed in /etc/apache2/sites-enabled. Then

/etc/init.d/apache2 reload

as pQd has already said.

Presumably DNS entries have been set up pointing * to the IP of the server or the FQDN, otherwise you'll have to do this or add a new DNS record for each as well.

share|improve this answer

pretty much it. usually in debian you have actual files in /etc/apache2/sites-available and sites-enabled directory contains only sym-links to earlier ones.

after any modifications tell apache about change in configs:

/etc/init.d/apache2 reload
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.