Objective: Create a virtual host for the domain valman.net
1. Create a directory in your document root
sudo mkdir -p /var/www/valman.net/public_html
2. Own the directory
sudo chown -R $USER:$USER /var/www/valman.net/public_html
3. Make the directory readable by the web server
sudo chmod -R 755 /var/www
4. Create the virtual host file from the Apache template
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/valman.net.conf
5. Edit the virtual host file valman.net.conf
ServerAdmin admin@valman.net
ServerName valman.net
ServerAlias www.valman.net
DocumentRoot /var/www/valman.net/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
6. Enable the virtual host
sudo a2ensite valman.net.conf
7. Don't forget to restart apache
sudo service apache2 restart
8. Edit your local host file (/etc/hosts)
127.0.0.1 localhost
127.0.1.1 valman.net