Configure Apache HTTP Server as a Proxy on a Windows OS

Last modified by Eleni Cojocariu-testing account on 2026/08/18 11:38

Tutorial

Apache HTTP Server forwards requests to the XWiki Servlet Container on a Windows system, using the directives XWiki needs. Windows has no Apache package, so the server is unpacked from an archive and registered as a Windows service; everything else is configured in the single httpd.conf file.

  1. Make sure your wiki is running and reachable locally, for example at http://localhost:8080/xwiki.
  2. Download an Apache Lounge build of Apache HTTP Server, version 2.4.47 or later, which is what the upgrade=websocket option below needs.
  3. Extract the archive to C:\Apache24.
  4. Set Define SRVROOT "C:/Apache24" in C:\Apache24\conf\httpd.conf to the directory you extracted to.
  5. Uncomment the #ServerName www.example.com:80 line in the same file and change it to ServerName localhost:80.
  6. Uncomment the three modules the configuration below needs, in the same file:
    LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_http_module modules/mod_proxy_http.so
    LoadModule headers_module modules/mod_headers.so
  7. Add the following block at the end of the same file:
    <VirtualHost *:80>
      ServerName localhost
    
      RedirectMatch ^/$ /xwiki/
    
      <Location /xwiki>
        Require all granted
      </Location>
    
      AllowEncodedSlashes NoDecode
    
      RequestHeader unset Forwarded
      RequestHeader unset X-Forwarded-Host
      RequestHeader unset X-Forwarded-Proto
    
      ProxyRequests Off
      ProxyPreserveHost On
    
      ProxyPass /xwiki http://localhost:8080/xwiki nocanon upgrade=websocket
      ProxyPassReverse /xwiki http://localhost:8080/xwiki
    </VirtualHost>
  8. Register Apache as a Windows service: open a Command Prompt as Administrator and run cd C:\Apache24\bin then httpd.exe -k install.
  9. Start the service: httpd.exe -k start. After any later change to httpd.conf, use httpd.exe -k restart instead.
  10. Open http://localhost in a browser. Apache redirects to http://localhost/xwiki/ and the wiki loads through port 80, with no port number in the address.

FAQ

Why does the service refuse to start after I edit the configuration?

Run httpd.exe -t from C:\Apache24\bin: it names the file and line of the directive Apache cannot parse, which the Windows service reports nowhere.

Where does Apache write its logs on Windows?

In C:\Apache24\logs, as error.log and access.log, unless ErrorLog and CustomLog point somewhere else.

Related

Get Connected