Configure Apache HTTP Server as a Proxy on a Linux OS
Tutorial
To set the Apache HTTP Server Proxy:
- Make sure your wiki is running and accessible locally, (e.g., at
http://localhost:8080/. - Install Apache HTTP Server (for Unix systems).
- Enable required Apache modules for proxy:
- Restart Apache.
- 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> - Enable the Apache site, using
a2ensite. - Reload Apache.
- Test the setup:
- Open your browser:
https://localhost. You should be redirected tohttps://localhost/xwiki. - XWiki should load correctly.
- Open your browser:
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.