Apache Server Key Configurations

Last modified by Eleni Cojocariu on 2026/05/20 16:51

Explanation

Warning

WIP

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 LineDescription/Official Apache Documentation
*:80The VirtualHost listents on all network interfaces (*) on port 80. All HTTP requests go through this block.
ServerNameSet to localhost for no custom domains.
RewriteEngine OnEnables 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}!=onCondition 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-knownCondition 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.
DocumentRootDocumentRoot
ErrorLog ${APACHE_LOG_DIR}/xwiki-error.log and CustomLog ${APACHE_LOG_DIR}/xwiki-access.log combinedSpecify 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.
 <Location /xwiki>
    Required all granted
 </Location>
Sets access permissions for /xwiki, allowing anyone to access this path.
AllowEncodedSlashes NoDecodeAllows special characters (/, +) to pass without decoding, since XWiki can encode slashes in URLs.
ProxyRequests OffProxy Rules: ProxyRequests. Make sure it is set to "Off", as specified in the Apache documentation.
SSLEngine onEnables SSL/TLS support for this VirtualHost, allowing the server to handle HTTPS requests.
SSLCertificateFile /path/to/certificateSpecifies 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/privatekeySpecifies 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.
ProxyPreserveHostProxy Rules: ProxyPreserveHost
ProxyPass /xwiki http://localhost:8080/xwiki nocanonMaps 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=websocketEnables 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.

Related

Get Connected