/home/josephspurrier

Run Apache HTTP on Windows without Installing

I’m a minimalist. I don’t like installing anything. I’d rather just save it as an RAR archive in my own folder structure and then unzip and double click when I need it. Now you can do it with Apache too.

First, download Apache for Windows (I’ll use the SSL version for this example).

http://httpd.apache.org -> Download from a Mirror -> Other Files -> binaries -> win32 -> httpd-2.2.22-win32-x86-openssl-0.9.8t.msi (or select the latest version MSI)

I’m actually going to use this one.

Download the Universal Extractor. It’s a nifty little tool that can extract the actual files from an installer. It works most of the time, but it’s a little outdated. If you have a better alternative, let me know. Also make sure you are allowed to extract from the MSI…some people don’t like when you do so.

I’d suggest downloading the Binary Archive…no install required! Unzip those files and then double click on UniExtract.exe. Now select the Apache MSI so it looks like this and click OK:

uniextract

Select the MSI Administrative Installer option and click OK:

uniextract2

Wait for the application to extract all the files. Once it finishes, there should be a directory in the same location as the MSI.

Navigate to: \httpd-2.2.22-win32-x86-no_ssl\program files\Apache Software Foundation\Apache2.2

This is where all the Apache files are located. The files occupy 34.2 MB so lets thin it out.

Delete the following folders to cleanup 24.6 MB of files:

The remaining folders and files should take up 9.61 MB and look like this:

apachefiles

You’ll need another tool called Awk or Gawk (same tool, different implementations). Download it from here. Just download the binaries (no install). Navigate to gawk-3.1.6-1-bin\bin and copy awk.exe to the root of your Apache files like this:

awk

Create a new file called Run.cmd and paste the following:

@ECHO OFF
REM Set the Apache variables (they must be outside of the IF statement)
SET SCRIPT=conf\original\installwinconf.awk
SET DOMAINNAME=localhost
SET SERVERNAME=localhost
SET SERVERADMIN=me@localhost
SET SERVERPORT=80
SET SERVERSSLPORT=443
SET SERVERROOT="%CD%"
SET SOURCEROOT=conf/original/
REM If the configuration is not done, config it!
IF EXIST conf\original\installwinconf.awk (
REM Create the required folders
MKDIR logs
MKDIR conf\extra
REM Create the configuration files
awk -f %SCRIPT% %DOMAINNAME% %SERVERNAME% %SERVERADMIN% %SERVERPORT% %SERVERSSLPORT% %SERVERROOT% %SOURCEROOT%
)
ECHO Starting Apache HTTPD...
START CMD /C bin\httpd.exe

To make it easy to deploy over and over again, I would Rar or Zip up all those files now. Its only a 2.27 MB Rar archive when compressed. If you make any mistakes in the next part, just delete the folders and extract from the archive again.

Just double click Run.cmd and Apache will start! Open up your browser to http://localhost and you should see: It works! Press Ctrl + C to gracefully shutdown Apache.

#apache