REDIRECT DOMAIN TO YOUR SERVER – Virtual Hosts Apache Ubuntu 16.04

0. Purchase domain on and redirect to your server

1.  Install Apache

sudo apt-get update

sudo apt-get install apache2

2. Create websIte directory


3. Check folder permissions

/var/www  must be 755 

4. Put an index.html / php inside the websitefolder to check if working

    <title>¡Bienvenido a!</title>
    <h1>¡Lo lograste! El virtual host está funcionando</h1>

5. Copy the default example of this route and modify with your needs.


6. Change the below for your new website.

<VirtualHost *:80>
    DocumentRoot /var/www/
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

7. Enable your site and restart apache with console.

service apache2 restart