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'm running Debian and I don't have a control panel or anything.

Right now, I'm simply pointing my domain to the server IP and it's going to the root, but I am looking to add another domain, so how would I do this?

I will point the new at the IP, but then how would I make it so it points it to a different directory?

share|improve this question
up vote 4 down vote accepted

Assuming you are talking about configuring an HTTP Server, and that it is Apache, in Debian, VirtualHosts are managed in directory /etc/www/apache2/sites-available. You create a text file here, with whichever name you want (it is good practice to use the same as the domain you are about to configure).

Lets say you have You create the file /etc/www/apache2/sites-available/ with the following contents:

<VirtualHost *:80>

  DocumentRoot /var/www/

  <Directory />
    Options FollowSymLinks
    AllowOverride None

  <Directory /var/www/sigma/html>
    Options FollowSymLinks MultiViews
    Order allow,deny
    allow from all

  LogLevel warn
  CustomLog /var/log/apache2/ combined
  ErrorLog  /var/log/apache2/


The you create a symlink on /etc/www/apache2/sites-enabled like this:

# cd /etc/www/apache2/sites-enabled
# ln -s ../sites-available/

This sets up your first virtual server. If you want to have copy this file to another one named after this new domain and change the parameter accordingly:

  • ServerName
  • ServerAlias
  • DocumentRoot
  • Directory
  • CustomLog
  • ErrorLog

Create the proper symlink and reload apache (/etc/init.d/apache2 reload)

You will have by default a file /etc/apache2/sites-available/default which sets the default virtual host for apache. That is solely because it is loaded first as /etc/apache2/sites-enabled/000-default. It is just another virtual host.

As far as DNS records, you can just point to the same address to which is pointed

There is much more to this configuration options, which you can read at the official Apache HTTP server documentation.


cgi-bin directory is just described as another directive on each virtualhost. Just add to configuration file something like:

ScriptAlias /cgi-bin/ /some/path/to/site1/cgi-bin

And to config file:

ScriptAlias /cgi-bin/ /some/path/to/site2/cgi-bin

Or you can even share the same directory for both servers. More on configuring CGI on apache

share|improve this answer
ok, and what about the cgi bin? Will i be able to just put it in /var/www/ – Belgin Fish Jan 12 '11 at 12:29
just another configuration directive to set up in each virtualhost. – Torian Jan 12 '11 at 21:10

I'm going to assume you're using Apache as your web server. If so, you are looking to implement Virtual Hosts - two (or more) domains, one IP.

Here are some nice tutorials to get you started...

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.