Configure Apache HTTP Server as a Proxy on a Linux OS

Last modified by Eleni Cojocariu on 2026/05/20 16:51

Tutorial

To set the Apache HTTP Server Proxy:

  1. Make sure your wiki is running and accessible locally, (e.g., at http://localhost:8080/.
  2. Install Apache HTTP Server (for Unix systems).
  3. Enable required Apache modules for proxy:
  4. Restart Apache.
  5. Configure the Virtual Hosts and the Reverse Proxy: edit your Apache configuration file (e.g., /etc/apache2/sites-available/xwiki.conf) and add:
    <VirtualHost *:80>
      ServerName localhost
    
      DocumentRoot /var/www/
    
      ErrorLog ${APACHE_LOG_DIR}/xwiki-error.log
      CustomLog ${APACHE_LOG_DIR}/xwiki-access.log combined
    
      RedirectMatch ^/$ /xwiki/
    
      <Location /xwiki>
        Require all granted
      </Location>
      
      AllowEncodedSlashes NoDecode
      
      ProxyRequests Off
      ProxyPreserveHost On
    
      ProxyPass /xwiki http://localhost:8080/xwiki nocanon upgrade=websocket
      ProxyPassReverse /xwiki http://localhost:8080/xwiki nocanon
    
    </VirtualHost>
    
  6. Enable the Apache site, using a2ensite.
  7. Reload Apache.
  8. Test the setup:
    1. Open your browser: https://localhost. You should be redirected to https://localhost/xwiki.
    2. XWiki should load correctly.

FAQ

How can I check if Apache is running locally?

Before configuring the proxy server for XWiki, you can check whether Apache is running by opening your browser and type http://localhost. If you see a page from Apache, it means it's running.

How can I configure the proxy server if I have a custom domain?

Replace the ServerName localhost with your custom domain, for example ServerName wiki.example.com. If needed (e.g., when using custom local domain, which are not real public domains), you must configure DNS resolution so that your system knows where to route the request. To do so, edit the hosts file to add for example 127.0.0.1 wiki.example.local.

What if I need also modules for  SSL, or other modules?

There are of course a lot of ways to configure the proxy server, and plenty of Apache modules, such as SSL. Check also more configurations for the Apache HTTP Proxy server.

What if I get 404 error

A common mistake is the following issue: 404 or broken links. Check: /xwiki mapping.

Related

Get Connected