Wiki source code of Setting up Apache HTTP Server

Version 6.1 by Thomas Mortagne on 2023/11/22

Show last authors
1 Example inpired from https://www.myxwiki.org (with only the important parts):
2
3 * any acces to port ##80## redirect to port ##443##
4 * proxy the port ##443## to the port ##8080## (where most application servers are listening by default)
5 * redirect ##/## access to ##/xwiki/##
6 * make sure XWiki have enough information to know what is the source URL
7 * make sure that special characters like ##/## and ##+## are allowed
8
9 {{code}}
10 <VirtualHost *:80>
11 ServerName mydomain.com
12 ServerAlias *.mydomain.com
13
14 RewriteEngine On
15 RewriteCond %{HTTPS} off
16 RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
17 </VirtualHost>
18
19 <VirtualHost *:443>
20 ServerName mydomain.com
21 ServerAlias *.mydomain.com
22
23 DocumentRoot /var/www/
24
25 ErrorLog /var/log/apache2/xwiki-error.log
26 CustomLog /var/log/apache2/xwiki-access.log combined
27
28 RedirectMatch ^/$ /xwiki/
29
30 <Location /xwiki>
31 Order Deny,Allow
32 Satisfy Any
33 </Location>
34
35 AllowEncodedSlashes NoDecode
36
37 ProxyRequests Off
38 <Proxy *>
39 Order deny,allow
40 Allow from all
41 </Proxy>
42 ProxyPreserveHost On
43 ProxyPass /xwiki http://localhost:8080/xwiki nocanon
44 ProxyPassReverse /xwiki http://localhost:8080/xwiki
45
46 ## Workaround for https://bz.apache.org/bugzilla/show_bug.cgi?id=58001 (ProxyPreserveHost does not includes Forwarded)
47 RequestHeader set Forwarded "proto=https"
48
49 # TODO: add your SSL setup
50 </VirtualHost>
51 {{/code}}

Get Connected