janvier
2
Creating a Apache Virtualhost allow you to manage several web site or subdomains.
Pre requisite : Apache is already installed and your domain name is already resolved by your DNS (check your DNS using ping command).
We will create a file to maintain the virtual hosts settings, ie :
nano /etc/apache2/sites-available/berthier.net
Copy/paste the following block in your file, replacing the domain name by your :
<VirtualHost www.berthier.net:80>
ServerAdmin postmaster@berthier.net
DocumentRoot /var/www/berthier.net/
CustomLog /var/log/apache2/berthier.net.log
LogLevel warn
</VirtualHost>
VirtualHost : The address you want to process. IP or star (*) are also allowed.
ServerAdmin : The website admin email
DocumentRoot : Where your files can be found (html, php… website root)
CustomLog : Optionnaly, where the system will write the log file
Loglevel : Verbose level of logs (debug | info | notice | warn | error | crit | alert | emerg)
You can copy/past the block as many as needed, in the same or different files. Save your file.
Create a symbolic link from site-enabled directory to site-available directory
cd /etc/apache2/sites-enabled/
ln -s ../sites-available/berthier.net
Restart Apache
/etc/init.d/apache2 restart