How-to configure a Reverse Proxy with Apache2 for Windows
As John has alluded to, the default configuration for Apache installed on Windows is at Program Files\Apache2.2\httpd.conf
in a flat file. The path may be somewhat different, as I don't have a Windows machine handy at the moment. Most Linux distributions have their own custom hierarchical structure which looks something like the following. This example is from Debian and may vary with other distributions.
/etc/apache2/
apache2.conf
Package provided configurationconf.d/
- Individual configuration files, usually from other packages, but could also be local configuration files
httpd.conf
Local configuration file. Overrides contents of apache2.confmods-available/
- Individual module configuration files, provided by the package and any support packages
mods-enabled/
- Links to files in
mods-available
. Links are created/removed witha2enmod
anda2dismod
. Creating a link enables the given module.
- Links to files in
ports.conf
Enabled portssites-available/
- Individual
VirtualHost
-style configuration files
- Individual
sites-enabled
- Links to files in
sites-available
. Links are created/removed witha2ensite
anda2dissite
. Creating a link enables the given site.
- Links to files in
I've described all this to hopefully make it easier to understand how to replicate it under Windows. With the exception that links are not well supported under Windows (has this changed in Vista/Server 2008/Windows 7?) it's relatively easy to set this structure up. But you will have to do it manually, since the default configuration doesn't do it for you. Make sure you adjust the following to match the Linux distribution you're migrating from.
Assuming the original configuration file on Windows is at
\Program Files\Apache2.2\httpd.conf
(again, this may not be the correct location, I'll need to check a Windows machine to be sure), create the following directories:\Program Files\Apache2.2\conf.d\
\Program Files\Apache2.2\sites-enabled\
You don't need the
sites-available
directories since links aren't supported under Windows. You can add them if you want, but things won't work the same. Also, I'd recommend putting the module configurations into the httpd.conf file. Since they aren't managed by the package manager, it will be easier to just keep them in one spot.Make any modifications from the Linux
httpd.conf
file to the Windows file. If you have anapache2.conf
file under Linux, this is easy, sincehttpd.conf
will only have overrides forapache2.conf
.Add a
ports.conf
file, if desired. The contents of this can also exist in the httpd.conf file.Copy files that exist in the Linux
conf.d
directory into the Windows directory. Make sure the filenames end with.conf
, adding it if it wasn't there before. This is done to help make directory parsing (set up below) less error prone.Copy files that exist in the Linux
sites-enabled
directory into the Windows directory. As in step 4, make sure the filenames end with.conf
, adding it if it didn't exist under Linux.Add the following to the end of the httpd.conf file:
# If you added a ports.conf file, add the following Include ports.conf # Include the conf.d files Include conf.d/*.conf # Include the enabled sites Include sites-enabled/*.conf
Restart Apache. Make sure you check for and correct any configuration errors.
This might not get you there 100%, but it should get you close.
Related videos on Youtube
Ice
I'm working as a consultant in a software company. Our developers are building a desktop-application on windows-platform using sql-server, exchange-server ... It's me who is talking to our customers to implement it on their systems.
Updated on September 17, 2022Comments
-
Ice over 1 year
I got up and running a reverse proxy on apache2 under Linux (Ubuntu). Now i see that there is a different folder-structure under Windows. My linux-conf - files don't work under windows or am i wrong?
Please show me the way
-
Ice over 14 yearsHi tinkertim, What Client configuration? i assumed the apache2 server-configuration under a windows2008-server which seems to be different to a linux-server. The Question has nothing to do with 'server' it's a issue of configuration and the difference between these two OS. Am i wrong?
-
Ice over 14 yearsTo be more precise: My linux configuration on 192.168.134.10 looks like that: /etc/apache2/sites-availbale/backuppc - this file holds the definition of a <VirtualHost *> To activate this i run: sudo a2ensite backuppc and sudo /etc/init.d/apache2 reload and everything is fine Apache under windows looks something different: - no folder sites-available - no folder sites-enabled and so on... Please show me the way, thx. Ice
-
-
Ice over 14 yearsHi John, i don't understand your question. I install apache 2 under linux and the folder struktur is given and so is it when i install a apache2 under windwos... The struktur is given in both cases and it is not the same? I don't have invented the folder-struktur wheter under linux nor under windows. This post is somewhat unpopular pushed from stackoverflow to serverfault - i could understand that... Please help.
-
John Gardeniers over 14 yearsThe folder structure you described is not standard under Windows. What's the problem? Just copy the structure, as I've already explained.
-
Ice over 14 yearsThis is an answer! thx Michael Johnson i soone will give it a try. you will get feedback. Ice
-
Ice over 14 yearsOk and you are shure that the apache service will find it's files?