Configuring Apache

Package installation

First, install the Apache server packages if they are not already present. On OpenSuse use:

zypper install apache2

On Amazon Linux 2 instead use:

yum install httpd mod_ssl

Configuration

While Tomcat can be used on its own to directly service clients, normally we would recommend using it behind Apache to take advantage of its cacheing facilities. Other services and features can also be more easily integrated in Apache.

A typical configuration for a Jiglu virtual host is as follows:

<VirtualHost 1.2.3.4:443>
ServerName jiglu.example.com:443
ServerAdmin (Address removed)

DocumentRoot "/var/lib/wwwrun"

AllowEncodedSlashes on
HostnameLookups Off
UseCanonicalName Off

ProxyRequests off

ProxyPass /ws/ ws://jiglu.example.com:8080/ws/
ProxyPassReverse /ws/ ws://jiglu.example.com:8080/ws/

ProxyPass / http://jiglu.example.com:8080/ max=100 nocanon
ProxyPassReverse / http://jiglu.example.com:8080/

CacheIgnoreHeaders Set-Cookie
CacheRoot /var/cache/httpd/
CacheEnable disk /

<LocationMatch "^/(editor|fonts|images|scripts|stylesheets)/">
ExpiresActive on
ExpiresDefault "access plus 1 year"
Header merge Cache-Control public
Header always unset Set-Cookie
</LocationMatch>

SSLEngine on
SSLCertificateKeyFile /etc/apache2/keys/example.key

ErrorLog /var/log/apache2/jiglu-error_log
</VirtualHost>

The mod_cache, mod_cache_disk, proxy, proxy_http and proxy_wstunnel modules must be loaded.

Note that the websocket proxy definition must precede the http proxy definition.

Automatic starting

To enable Apache to start when the server is booted, on OpenSuse use:

systemctl enable apache2
systemctl start apache2

On Amazon Linux 2 use:

systemctl enable httpd
systemctl start httpd
Written by Stephen Hebditch. Published on .
8.0.0
How to configure Apache as an accelerating reverse proxy for Jiglu.