apache Getting started with apache [Ubuntu] Simple Hello World Example


Example

This example will guide you through setting up a back end serving an a Hello World HTML page.

Installing Requirements


Order matters for this step!

  • sudo apt-get install apache2

Setting up the HTML


Apache files live in /var/www/html/. Lets quickly get there. Make sure you're in your root directory first, cd, then cd /var/www/html/.

This html directory is where all your website files will live. Lets quickly make a simple Hello World file.

Using your favorite text editor, type the following in

<!DOCTYPE html>
<html>
<head>
    <title>Hello World!</title>
</head>
<body>
    <h1>Hello World!</h1>
</body>
</html>

Save this file as index.html in the current directory and you're set to go!

Visiting Your Webpage


To visit the page you just created, in your browser of choice, go to localhost. If that doesn't work, try 127.0.0.1. You should see "Hello World!" as a h1. You're done!