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 instead use:

yum install httpd24 mod24_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. Upload virus scanning and protection against server attacks 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 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 instead use:

chkconfig httpd on
service httpd start
Written by Stephen Hebditch. Published on .
5.0.0
How to configure Apache as an accelerating reverse proxy for Jiglu.