Installing and Configuring Apache Web Server
Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
Step 1: Configure IIS
Apache listens for requests on TCP/IP port 80. You need to uninstall or disable any program that uses that port. If you have a Professional or Server version of Windows, you may already have IIS installed. If you would prefer Apache, either remove IIS as a Windows component or disable its services.
Step 2: Download the files
We’re going to use the unofficial Windows binary from Apache Lounge. This version has performance and stability improvements over the official Apache distribution, although I’m yet to notice a significant difference. However, it’s provided as a manually installable ZIP file from www.apachelounge.com/download/.
You should also download and install the Windows C++ runtime from Microsoft.com. You may have this installed already, but there is no harm installing it again.
Step 3: Extract the Files
We’ll install Apache in C:/Apache24
, so extract the ZIP file to the root of the C:/
drive. Apache can be installed anywhere on your system, but you’ll need to change SVROOT
configuration to point to your unzipped location — suh as E:/Apache24
.
Step 4: Configure Apache
Apache is configured with the text file conf/httpd.conf
contained in the Apache folder. Open it with your favorite text editor.
Note that all file path settings use a forward slash (/
) rather than the Windows backslash. If you installed Apache anywhere other than C:/Apache24
, now is a good time to search and replace all references to C:/Apache24
.
There are several lines you should change for your production environment:
Line 60, listen to all requests on port 80:
Listen *:80
Line 162, enable mod-rewrite by removing the # (optional, but useful):
LoadModule rewrite_module modules/mod_rewrite.so
Line 227, specify the server domain name:
ServerName localhost:80
Line 224, allow
After this test your installation….htaccess
overrides:AllowOverride All
Step 5: Test your Installation
Your Apache configuration can now be tested. Open a command box (Start > Run > cmd
) and enter:
# navigate to Apache bin directory
cd /Apache24/bin
# Test httpd.conf validity
httpd -t
It should say “Syntax OK”. If not, correct any httpd.conf
configuration errors and retest until none appear.