Install apacheCreate new Virtual host fileEnable new Virtual hosts files:Restart Apache:Configurar el archivo de hosts local
We continue to play with Debian on our test server, today we are presented with the need to configure a Virtual Host, so helped by 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 name of the file. (For testing will use the name: virtual)
Then we must change the following fields ServerName, ServerAdmin,DocumentRoot
Enable 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.
There 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