Wiki source code of Configure Apache HTTP Server as a Proxy on a Linux OS
Last modified by Eleni Cojocariu on 2026/05/20 16:51
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | To set the Apache HTTP Server Proxy: | ||
| 2 | |||
| 3 | 1. Make sure your wiki is running and accessible locally, (e.g., at {{code language="none"}}http://localhost:8080/{{/code}}. | ||
| 4 | 1. [[Install Apache HTTP Server>>https://httpd.apache.org/]] (for Unix systems). | ||
| 5 | 1. Enable required [[Apache modules>>https://httpd.apache.org/docs/current/fr/mod/]] for proxy:((( | ||
| 6 | * [[##proxy_module##>>https://httpd.apache.org/docs/current/fr/mod/mod_proxy.html#access]] | ||
| 7 | * [[##proxy_http_module##>>https://httpd.apache.org/docs/current/fr/mod/mod_proxy_http.html]] | ||
| 8 | * [[##headers_module##>>https://httpd.apache.org/docs/current/fr/mod/mod_headers.html]] | ||
| 9 | * [[##rewrite##>>https://httpd.apache.org/docs/current/fr/mod/mod_rewrite.html]] | ||
| 10 | ))) | ||
| 11 | 1. Restart Apache. | ||
| 12 | 1. Configure the Virtual Hosts and the Reverse Proxy: edit your Apache configuration file (e.g., ##/etc/apache2/sites-available/xwiki.conf##) and add:((( | ||
| 13 | {{code language="apacheconf"}} | ||
| 14 | <VirtualHost *:80> | ||
| 15 | ServerName localhost | ||
| 16 | |||
| 17 | DocumentRoot /var/www/ | ||
| 18 | |||
| 19 | ErrorLog ${APACHE_LOG_DIR}/xwiki-error.log | ||
| 20 | CustomLog ${APACHE_LOG_DIR}/xwiki-access.log combined | ||
| 21 | |||
| 22 | RedirectMatch ^/$ /xwiki/ | ||
| 23 | |||
| 24 | <Location /xwiki> | ||
| 25 | Require all granted | ||
| 26 | </Location> | ||
| 27 | |||
| 28 | AllowEncodedSlashes NoDecode | ||
| 29 | |||
| 30 | ProxyRequests Off | ||
| 31 | ProxyPreserveHost On | ||
| 32 | |||
| 33 | ProxyPass /xwiki http://localhost:8080/xwiki nocanon upgrade=websocket | ||
| 34 | ProxyPassReverse /xwiki http://localhost:8080/xwiki nocanon | ||
| 35 | |||
| 36 | </VirtualHost> | ||
| 37 | |||
| 38 | {{/code}} | ||
| 39 | ))) | ||
| 40 | 1. Enable the Apache site, using {{code language="none"}}a2ensite{{/code}}. | ||
| 41 | 1. Reload Apache. | ||
| 42 | 1. Test the setup:((( | ||
| 43 | 1. Open your browser: {{code language="none"}}https://localhost{{/code}}. You should be redirected to {{code language="none"}}https://localhost/xwiki{{/code}}. | ||
| 44 | 1. XWiki should load correctly. | ||
| 45 | ))) |