Wiki source code of More Configurations for the Apache HTTP Proxy Server
Last modified by Eleni Cojocariu on 2026/05/06 14:55
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | {{warning}} | ||
| 2 | WIP | ||
| 3 | {{/warning}} | ||
| 4 | |||
| 5 | After [[Configuring the Apache HTTP Server as a Proxy on a Linux OS>>documentation.xs.admin.installation.http-reverse-proxy.apache-key-configurations.configure-apache-server-linux.WebHome]] or [[on Windows>>documentation.xs.admin.installation.http-reverse-proxy.apache-key-configurations.configure-apache-server-windows.WebHome]], you can add several improvements to the configuration. For example, you can enable ##HTTPS## secure connections. To do this, you need to enable the [[Apache ##SSL## module>>https://httpd.apache.org/docs/current/fr/mod/mod_ssl.html]] and use an additional ##<VirtualHost>## on port ##443## where you also move the [[Proxy Rules>>documentation.xs.admin.installation.http-reverse-proxy.apache-key-configurations.WebHome]] from ##<VirtualHost *:80>##. Thus, modify and add in the ##/etc/apache2/sites-available/xwiki.conf## file: | ||
| 6 | |||
| 7 | ((( | ||
| 8 | {{code language="apacheconf"}} | ||
| 9 | <VirtualHost *:443> | ||
| 10 | ServerName localhost | ||
| 11 | |||
| 12 | SSLEngine on | ||
| 13 | SSLCertificateFile /path/to/certificate | ||
| 14 | SSLCertificateKeyFile /path/to/privatekey | ||
| 15 | |||
| 16 | ProxyRequests Off | ||
| 17 | ProxyPreserveHost On | ||
| 18 | |||
| 19 | RequestHeader set X-Forwarded-Proto "https" | ||
| 20 | |||
| 21 | ProxyPass /xwiki http://localhost:8080/xwiki | ||
| 22 | ProxyPassReverse /xwiki http://localhost:8080/xwiki | ||
| 23 | </VirtualHost> | ||
| 24 | {{/code}} | ||
| 25 | ))) | ||
| 26 | |||
| 27 | To redirect HTTP to HTTPS, use a port ##80 VirtualHost## with ##Rewrite Rules##: | ||
| 28 | |||
| 29 | ((( | ||
| 30 | {{code language="apacheconf"}} | ||
| 31 | <VirtualHost *:80> | ||
| 32 | ServerName localhost | ||
| 33 | RewriteEngine On | ||
| 34 | RewriteCond %{HTTPS} !=on | ||
| 35 | RewriteCond %{REQUEST_URI} !^/.well-known | ||
| 36 | RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] | ||
| 37 | </VirtualHost> | ||
| 38 | {{/code}} | ||
| 39 | |||
| 40 | Make sure you update the [[XWiki configuration file (##xwiki.cfg##)>>documentation.xs.admin.configuration.WebHome]] with the new URL, (e.g., {{code language="none"}}xwiki.home=https://localhost/xwiki{{/code}}). | ||
| 41 | ))) | ||
| 42 | |||
| 43 | After making changes in the configuration file, test and restart Apache. |