Your first website


After reading our Installing The Web Server and Making it Live articles, you should have a live web server broadcasting to the internet ready to host your first website!

I’m only going to cover the basics in this article, that is how to replace the Apache default page with your own website.

Start your first website

First, you need to run a command to make sure you have ownership: (replace user with your username on your Linux PC)

sudo chown -R user:root /var/www/*

It won’t say anything but following this you should have ownership of all the files and folders within the www folder

Next use your file manager (usually Dolphin in Debian or Nautilus in Ubuntu) to navigate to the folder as shown below:

Create the homepage

If there’s an index.html file in the www folder already, you need to delete the file before going any further!

Next, right click the empty space inside the www folder and select Create New and then Text File from the sub-menu.

If Create New is greyed out, you need to go back to the start of this article where we set the ownership and try again, it means you don’t have permission to change this folder.

Name the new file index.html

(remember to remove the .txt extension)

That’s your web page! Next, we need to add some code to it, otherwise you’ll just see a blank page.

Add the content

Open the file with your text editor (I prefer Notepadqq but to keep it simple I’m going to use KWrite)

Now you can copy and paste the code below into the text editor and save it:

<!DOCTYPE html>
<html>
    <head>
    <title>Linux Made Easy Test Page</title>
    </head>

    <body>
        <p>This page is made by LinuxMadeEasy.com and is only for testing.</p>
    </body>
</html>

If you have your own code use that instead of course!

That’s it! Now the Apache default page should have changed to your new web page.

Remember to refresh the page in your browser, use CTRL + F5 to force a hard refresh if it isn’t working.

Now you can edit the text file to make changes to your website and build it from there

If you want to learn how to get started with building a website from your new index.html file, you can find all the information you need from: W3Schools Introduction to HTML