Apache Server Key Configurations
Last modified by Eleni Cojocariu on 2026/05/20 16:51
Content
Explanation
Apache HTTP Server is a widely used open-source web server used also as a reverse proxy, forwarding client requests to backend applications, such as XWiki. The following configuration keys ensure proper communication between Apache and XWiki:
| Configuration Line | Description/Official Apache Documentation |
|---|---|
*:80 | The VirtualHost listents on all network interfaces (*) on port 80. All HTTP requests go through this block. |
| ServerName | Set to localhost for no custom domains. |
| RewriteEngine On | Enables the runtime rewriting engine provided by Apache mod_rewrite. This must be set to On in order for any RewriteCond or RewriteRule to be processed. |
| RewriteCond %{HTTPS}!=on | Condition that checks whether the current request is not using HTTPS. If the request is made over HTTP, the rule will be applied. This is commonly used to enforce secure connections. |
| RewriteCond %{REQUEST_URI} !^/.well-known | Condition that ensures that requests starting with /.well-known are not redirected. Check also Apache rewrite module documentation. |
| RewriteRule ^/?(.*)https:%{SERVER_NAME}/$1 [R,L] | RewriteRule that forces all HTTP requests (except those matching the specified condition) to be redirected to the HTTPS version of the same URL. Check also Apache rewrite module documentation. |
| RewriteRule ^/xwiki/(.*)ws:localhost:8080/xwiki/$1 [P,L] | Proxies matching requests to the backend using ws://##. The [P] flag enables proxying, [L] stops further processing. |
| DocumentRoot | DocumentRoot |
| ErrorLog ${APACHE_LOG_DIR}/xwiki-error.log and CustomLog ${APACHE_LOG_DIR}/xwiki-access.log combined | Specify the path for logs to help debug. |
| RedirectMatch ^/$ /xwiki/ | Matches requeststo the root URL / and redirects them to /xwiki/. Typing http://localhost automatically goes to XWiki. |
| Sets access permissions for /xwiki, allowing anyone to access this path. |
| AllowEncodedSlashes NoDecode | Allows special characters (/, +) to pass without decoding, since XWiki can encode slashes in URLs. |
| ProxyRequests Off | Proxy Rules: ProxyRequests. Make sure it is set to "Off", as specified in the Apache documentation. |
| SSLEngine on | Enables SSL/TLS support for this VirtualHost, allowing the server to handle HTTPS requests. |
| SSLCertificateFile /path/to/certificate | Specifies the path to the SSL certificate file (public certificate). This file is used to identify the server to clients during the HTTPS handshake. See also SSLCertificateFile directive. |
| SSLCertificateKeyFile /path/to/privatekey | Specifies the path to the private key associated with the SSL certificate. This key must match the certificate defined in SSLCertificateFile and is required to establish secure connections. See also SSLCertificateKeyFile directive. |
| ProxyPreserveHost | Proxy Rules: ProxyPreserveHost |
| ProxyPass /xwiki http://localhost:8080/xwiki nocanon | Maps incoming requests to the backend server. The nocanon option ensures that special characters (such as ;) are not modified or re-encoded by the proxy. |
| ProxyPass /xwiki http://localhost:8080/xwiki upgrade=websocket | Enables WebSocket support by allowing protocol upgrades when required (used for features like real-time updates). |
| RequestHeader set X-Forwarded-Proto "https" | Ensures HTTPS is properly detected by XWiki. When Apache terminates SSL and forwards requests to XWiki over HTTP, the backend application may not detect that the original request was made over HTTPS. |
| ProxyPassReverse /xwiki http://localhost:8080/xwiki## | Proxy Rules: If XWiki sends a redirect pointing to localhost:8080, Apache rewrites it to /xwiki. |
More
To find more about the current topic, you can search or use the table below and filter the columns to narrow your choices.