Adding apache and php to your bare server configuration

The basic Ubunu server install does not have apache and php installed by default, so you will need to add them to the system.

sudo apt install apache2 php php-mysql

Verify that your webserver and php are working, by visiting you public ip address. This should display the default apache welcome page. Next, navigate to /var/www/html and create a new file that will display the php configuration and thus verify that php is working correctly.

cd /var/www/html
sudo nano info.php

Content of the file:

<?php echo phpinfo(); ?>

Now open the info.php file in your web browser to verify php is working correctly.