The Virtual Host or vHosts allow the hosting of several domains on a same system usually having only one public IP.


At first, your system need at least Apache if not a LAMP structure (Linx/Apache/MySQL/PHP). If necessary, we install it via the following command :

This tutorial provides details about how to host the and on the same system.


Then we are going to implement the arborescence needed to establish our vhost to manage both domains :

We give the rights matching the folders www, and

We created 2 pages HTML by default for each web sites :

vHost creation

From now on, we can move to the creation of our vhost by copying the default configuration file :

By default, both files and will look like the following result :

So we are going to change and add the following elements which will be adapted to both domains :

The email address included by the server in error messages sent to the client.

Arborescence’s root of the documents, the php function realpath can help you to get the information if necessary.

Hostname and port used by the server to authenticate itself.

Other server’s names used to reach virtual servers based on name.

Now you must activate the 2 vhosts via a2ensite which is included in Apache then relaunch Apache :

Local configuration

It is possible that your domains may not be available for various reasons.
In this case, we are going to change the local configuration of your system to test your vhosts:

Your machine’s IP to change.

Both your sites are now operational as long as the DNS zones are properly configured.

Categories: SystemTutorials

JN Community

Les Ressources, en particulier les tutoriaux, présupposent que l’Utilisateur qui décide de les mettre en œuvre dispose des connaissances, des compétences et de l’expérience nécessaire pour cette mise en œuvre. L’Utilisateur disposant d’une connaissance, compétence et/ou expérience limitée ou insuffisante doit absolument s’abstenir de mettre en œuvre les Ressources par lui-même. Jaguar Network décline toute responsabilité quant aux conséquences dommageables de la mise en œuvre des Ressources, notamment sur les infrastructures informatiques de l’Utilisateur, de ses commettants ou préposés ou de tout tiers. Il est précisé en tant que de besoin que toute intervention de Jaguar Network visant à réparer les dommages causés par la mise en œuvre des Ressources par un Utilisateur ne disposant pas des connaissances, compétences et/ou expériences suffisantes sera facturée et fera l’objet d’un devis préalable et d’un bon de commande aux conditions des contrats Jaguar Network en vigueur.

Related Posts


Shutdown and restart your Linux system

Vote On Linux system, there are a lot of commands to shutdown and reboot your system. This tutorial aims to detail some existing possibilities. Articles similaires


Installation of a web server LEMP (Linux, Nginx, MySQL, PHP)

Vote The installation of a server LEMP Linux + Nginx + MySQL + PHP might be more useful and efficient than an Apache (server LAMP). Articles similaires


Operating load-balancing with HAproxy

Vote HAproxy is a software allowing Load-Balancing between several web servers by allocating requests in an almost transparent way for the user. Articles similaires