This site uses third-party cookies, learn more or accept
dark light

Run Apache on Windows without any extra software

Written by Max Pelic on

I'm the kind of guy who doesn't like to install extra software, and would rather spend the time to do something the most basic way instead of doing something the easiest way.

That's why I installed Apache on my Windows computer (windows 10) without using any extra software to set it up. I'm currently running Apache with MySQL and PHP 7.

Download Apache

You can download Apache for windows from a number of different websites, including Apache Haus. You can view a full list on the Apache Website.

Once you select the right version, copy the Apache24 folder out of the zip file and into the C: directory on your computer.

Setting up your server configuration

In the conf folder, you should see a file called httpd.conf. Open it with your favorite text editor (Notepad should work fine), and add a line like this (you can choose any convenient file path, I chose the documents folder in this example). This will be a file where you can edit your server settings without having to navigate to the Apache24 folder.

1Include "C:\Users\(your username)\Documents\server.conf"

Once you create the new file (wherever you set the path to), open it and add this code to set up your Apache server.

1#Set up your server to listen to port 80 (the default port on your machine) 

2
Listen *:80
3
4#Set up the path to your server root folder
5
DocumentRoot "C:\Users\(your username)\Documents\(website root folder)"
6
7#Allow access to your folder
8
<Directory "C:\Users\(your username)\Documents\(website root folder)">
9 Require all granted
10</Directory>
11
12#Set the server name for your site
13
ServerName localhost
14
15#Set up the default file for each directory
16
#You can change this based on which file types you have
17
DirectoryIndex index.php index.html index.shtml
18
19#If you are running PHP, you'll need to set this up to direct to the folder where you have PHP installed
20
Action application/x-httpd-php "C:/PHP7/php-cgi.exe"
21#Set the path to the php.ini file
22
PHPIniDir /PHP7

Run Apache on startup

To start Apache, navigate to the Apache folder you installed, open the bin folder, and run the httpd.exe file. Your server should now be accessible from http://localhost.

To make your server automatically start when you turn on your computer, open task manager, click the services tab, right click on the Apache24 task, and click "go to services".

Now right click on the Apache2.4 service, click properties, and change the startup type to Automatic.

Share this article:

Previous Article: Javascript Prime Number generator

Next Article: Fallback resource overview