Create directories for a new site. E.g.

In /etc/apache2/conf.d/ create new file virtual.conf
# Running multiple virtual hosts.
NameVirtualHost *

This contains configuration files for sites which are available but not necessarily enabled.
This directory contains site files which are enabled.
Each configuration file in the sites-enabled directory is loaded when the server starts - whilst the files in sites-available are ignored.
Configuration files should be created in sites.available and later enabled running a2ensite command if needed (see bellow).

Create /etc/apache2/sites-available/ with the following contents:

<VirtualHost *>
ServerAdmin This email address is being protected from spambots. You need JavaScript enabled to view it.

# Indexes + Directory Root
DirectoryIndex index.php index.html
DocumentRoot /var/www/sites/

# CGI Directory
ScriptAlias /cgi-bin/ /var/www/Sites/
<Location /cgi-bin>
Options +ExecCG

# Logfiles
ErrorLog  /var/www/sites/
CustomLog /var/www/sites/ combined

Enable site:
(To disable - a2dissite
This puts symbolic link in sites-enabled

Restart apache:
/etc/init.d/apache2 reload

In addition (after change from one website to multiples):
Delete: default in sites-available and 000-default in sites enabled

Default site:
One of the sites is a default site. Default site is loaded when server can't match URL address.
It looks like the default site is the one which comes first in alphabetical order in sites-available folder. 

To stop warning NameVirtualHost *:80 has no VirtualHosts when reloading apache
#NameVirtualHost *:80

To stop warning apache2: Could not reliably determine the server's fully qualified domain name, using for ServerName when reloading apache
Add Line:

Ubuntu Server 10.10

No comments

Leave your comment

In reply to Some User
Captcha Image