Host your own local website with Apache.

Note: This tutorial is for Windows only.

Before attempting this tutorial, please ensure that you have some basic knowledge of HTML.

Part 1: Downloading Apache

Firstly you need to install Apache on your computer. Firstly, go to https://www.apachelounge.com/download/ and download the latest version for your system (ensure that it’s the correct one: 32 or 64 bit). Once it has downloaded, right click on the .zip file and click on ‘extract’. Extract the .zip to your C:\ directory (ensure that it is installed here and not in a subdirectory). It will add a folder called Apache24. Now Apache is installed!

Part 2: Downloading Visual C++ Redistributable for Visual Studio

In order for Apache to work at all, you need to have Visual C++ Redistributable for Visual Studio installed. You can download it here: https://www.microsoft.com/en-us/download/details.aspx?id=48145. Run the .exe application to install it, and then restart your computer.

Part 3: Creating a webpage

Open your favourite text editor (I recommend Notepad++) and open the index.html file located in C:\Apache24\htdocs. ‘htdocs’ is the folder where all of your webpages will be kept. You can now create your homepage, or copy my example below as a test:

<html>
<head>
<title>Home</title>
</head>
<body style="background-color:#bad4ff;font-family:sans-serif;">
<div style="text-align:center;">
<h1>Test successful!</h1>
<a href="http://www.google.com"><h2>Google</h2></a>
<img src="http://genesis-theme-aestetics.esy.es/wp-content/uploads/2014/10/example.jpg" alt="example" width=15%>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas in lacus rhoncus, 
condimentum lorem id, commodo mi.</p>
</body>
</html>

Part 4: Running the web server

Now we need to start our web server. Press the Windows key and R ( + R) to open Run, type in ‘cmd’ and press enter. A Command Prompt window should appear. Now type in C:\Apache24\bin\httpd.exe. Now your web server is running! Do not close the Command Prompt window because the web server is running inside it. Now, open a browser and go to http://localhost/ . Your home page should appear. Now you can create more pages and link them together. Remember, to link to other html files in htdocs using the <a> tag simply type in the name of the page. There is no need for the full path as they are all in the same folder. Enjoy!

Troubleshooting

I can’t extract the Apache file: Make sure that the file you’ve downloaded is a .zip file. If it isn’t, go to https://www.apachelounge.com/download/ and download a .zip file instead.

I’m getting an error when starting apache – “no VCRUNTIME140.dll”: To fix this problem, try installing the other version of Visual C++ Redistributable for Visual Studio. If you installed x64, try x86 and vice versa.

I’m getting a warning when starting Apache – “Could not reliably determine the server’s fully qualified domain name”: Close CMD and go to Apache24\conf. Open the httpd.conf file using a text editor such as Notepad. Add this line to the end of the file:

ServerName localhost

and start your web server again.