Tips and tricks on developing web sites

Installing Apache Server

If you go to the Apache Lounge website you can locate pre-compiled versions of Apache for Windows (or you can try to compile it yourself but that’s another topic altogether). We are looking for a 64bit Windows version and they have version 2.4.46 conveniently located there for download. In this case, it was named Right-click on it and extract the files to your C:\ directory. I suggest reviewing the readme.txt file and moving the Apache24 folder to C:\Apache24.

In your text editor, open C:\Apache\conf\httpd.conf and change these lines:

#ServerName change to (uncomment)
#Include conf/extra/httpd-vhosts.conf change to (uncomment)
Include conf/extra/httpd-vhosts.conf
<IfModule dir_module>
    DirectoryIndex index.html change to
<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule> change to

Apache is started with http.exe executable in C:\apache24\bin. If you run that you may get a VCRuntime error. That just means Apache needs Visual C to run. You can download and install that from Microsoft here.

You will also get this annoying error even if you run httpd.exe as Administrator. To disable that go to the Windows Start Menu and type gpedit. Go to Computer Configuration->Administrative Templates->Windows Components->File Explorer. Click on Configure Windows Defender SmartScreen. Set it to disabled and save the change.

The first time you successfully run Apache (http.exe) you will get a firewall warning. Enable the Firewall for private networks. You can now go to your browser and type in localhost as the address. You should get a blank screen saying It Works! Awesome, Apache has been installed!

At this point, you may want to install Apache a Windows Service by entering these command lines at an Administrator Command prompt (Start Menu, type cmd, right-click saying run as Administrator). Once Apache is running smoothly you will want to control Apache using ApacheMonitor located in C:\Apache\bin\ApacheMonitor.exe. The advantage of running apache from a command prompt using httpd.exe is that you will get to see error messages clearly.

bin\httpd -k install

We should mimic your Host provider at this point and make a folder in C:\Apache24\htdocs\ called public_html if this is your primary site. If it is an add-on domain we would make a folder called In there, create a text file named index.php and add this info:

<html><body>My new site works!!!</body></html>

Edit C:\Apache24\conf\extra\httpd-vhosts.conf. Comment out any existing virtual hosts with #‘s (every line in the virtual host sections) and add:

<VirtualHost *:80>
	ServerAlias *
	DocumentRoot "c:/apache24/htdocs/public_html"	
	<Directory "c:/apache24/htdocs/public_html">
	ErrorLog "logs/" 
	CustomLog "logs/" common	

Start C:\Apache\bin\httpd.exe server and type localhost in your browser. You should get a line saying My new site works!!! If you aren’t installing an HTTPS/SSL server, you can stop here and move onto PHP and MySQL.

Setting up Apache for SSL/HTTPS

There are a lot of ways to do this, and it can be quite frustrating depending on what path you decide to take. This method works for me. Open C:\Apache24\conf\httpd.conf in your text editor. Change the following lines:

#LoadModule ssl_module modules/   Remove Comment
LoadModule ssl_module modules/
#Include conf/extra/httpd-ssl.conf  Remove Comment
Include conf/extra/httpd-ssl.conf
#LoadModule socache_shmcb_module modules/  Remove Comment
LoadModule socache_shmcb_module modules/

Using your text editor make a batch file in C:\Apache24 called makecert.bat. Edit the file adding the line:

bin\openssl req -x509 -sha256 -newkey rsa:2048 -keyout conf\server.key -out conf\server.crt -days 999 -nodes -subj "/" -addext "" -config example.cnf

Make another file called example.cnf and add the following. You can change the C, ST, L, O, OU values to anything you want- they aren’t important.

distinguished_name = req_distinguished_name
x509_extensions = v3_req
prompt = no
C = US
CN =
keyUsage = critical, digitalSignature, keyAgreement
extendedKeyUsage = serverAuth
subjectAltName = @alt_names
DNS.1 =
DNS.2 =
DNS.3 =

Go to a command prompt (Windows key+R type CMD) and move to the Apache directory cd\apache24\. Type makecert.bat and enter. You will get a message saying a new private key has been generated. Look in C:\Apache24\conf and you should see files called server.key and server.crt

Edit C:\xampp\apache\conf\extra\httpd-vhosts.conf and add this section to the end of the file. You would replace public_html with your addon-domain name if you were adding one (it would be folder in this case)

<VirtualHost *:443>
	ServerAlias *
	DocumentRoot "c:/apache24/htdocs/public_html"	
	<Directory "c:/apache24/htdocs/public_html">
	ErrorLog "logs/" 
	CustomLog "logs/" common	
	SSLEngine on
	SSLCertificateFile "conf/server.crt"
	SSLCertificateKeyFile "conf/server.key"

Start the Apache Server (run c:\Apache24\bin\httpd.exe) or stop and start it if you run as a service. Apache Monitor is handy for doing this too. In the browser, enter You will get a nasty certificate warning, but that’s ok because your certificate doesn’t have a valid authority. Click on advanced and choose to continue at the bottom of the window.

Apache Service Monitor

Apache Service Monitor is a handy tool to make sure Apache Server is running properly. In this example it is located at C:\Apache24\bin\ApacheMonitor.exe. Run it and you will see a tiny icon open up in the lower right of the task bar.

Right-click on the monitor and select Open Apache Monitor to view the panel.

At this point, you have a functioning HTTPS or HTTP server. If you aren’t using PHP or MySQL, you are good to go. You should rename your index.php to index.html if you aren’t using PHP.