Now you can browse to the web-site by pointing your browser to the IP address of the
machine. In my case it was http://107.170.93.222/
Please note, some browsers will not work properly if you don't put the http:// in front of the IP address.

If everything works fine you will see something like this in the browser:

This is the content of the /var/www/index.html file on the server.

You can edit that file, and reload the page in the browser.

Creating the first CGI script in Perl

Create the /var/cgi-bin directory

(Please note, we don't create this inside the /var/www directory on purpose.
This way, even if misconfigured the server it won't serve the source code of the script.
Which is a good thing.)

mkdir /var/cgi-bin

and create a file called /var/cgi-bin/echo.pl
with the following content:

By default this Apache instance does not have the CGI module enabled.
This we can see by noticing that the mods-enabled directory does not have any of the cgi files
that are available in the mods-available directory:

After changing the script if you access the page now it will display the current time on the server.
If you reload the page, it will show the new current time.

Trouble shooting

If when you access the http://107.170.93.222/cgi-bin/echo.pl URL you see
the content of the script instead of the word "hi" then you probably put the cgi-bin directory
inside the /var/www and/or probably forgot to create the symbolic links for the cgid.* files.
Move the cgi-bin directory outside the /var/www, update the configuration files, set up
the symbolic links, and reload the server.

500 Internal Server Error

If you get an 500 Internal Server Error look at the error log in /var/log/apache2/error.log