We continue playing with Debian on our test server, today we were presented with the need to configure a Virtual Host, so with the help of a university guide I built a step by step to configure Apache virtual hosts in Debian.
Install apache
sudo apt-get update
sudo apt-get install apache2
Create new Virtual host file
Download our test virtual.conf file from here.. Then we must copy the file virtual.conf to the folder /etc/apache2/sites-available/ for the new domain.
cp virtual.conf /etc/apache2/sites-available/
If required, we can change the file name. (For testing we will use the name: virtual )
Next we must change the following fields ServerName, ServerAdmin, DocumentRoot
Enable the new Virtual hosts files:
a2ensite virtual.conf
Restart Apache:
service apache2 restart
Configurar el archivo de hosts local
Open the file hosts for it type nano /etc/hosts
Add the new IP of your server at the bottom of the file as localhost.
It will be something like this:
127.0.0.1 localhost 127.0.0.10 wp 127.0.0.11 yii # The following lines are desirable for IPv6 capable hosts :: 1 localhost ip6-localhost ip6-loopback ff02 :: 1 ip6-allnodes ff02 :: 2 ip6-allrouters
With this, a Virtual Host in Debian would be well configured