Apache2 can therefore be installed it like this:
sudo apt-get -y install apache2
Now direct your browser to http://hostname, and you should see the Apache2 default page (It works!):
The document root of the apache default vhost is /var/www/html on Ubuntu and the main configuration file is /etc/apache2/apache2.conf. The configuration system is fully documented in /usr/share/doc/apache2/README.Debian.gz.
Enable the SSL website in apache
SSL/ TLS is a security layer to encrypt the connection between the web browser and your server. Execute the follwoing commands on your server to enable https:// support. Run:
a2enmod ssl a2ensite default-ssl
which enables the ssl module and adds a symlink in the /etc/apache2/sites-enabled folder to the file /etc/apache2/sites-available/default-ssl.conf to include it into the active apache configuration. Then restart apache to enable the new configuration:
systemctl restart apache2
Now test the SSL connection by opening https://hostname in a webbrowser. Note that the SSL-certificated is a self signed, hence untrusted certificate!
Some helpfull combined bash commands
site=[your vhost].box && sudo nano /etc/apache2/sites-available/$site.conf && sudo a2ensite $site && sudo service apache2 reload