Apache2 configuration

A Web Server can be configured to reduce the load of the Application Server by handling static content. It is recommended to do this, as /quit will shut-down the Application Server.

Static content:

  • index.html - generated by the Schema bot.
  • schema.js - the Javascript file
  • external_link.png - image file used to indicate the link will open a new tab
  • favicon.ico - branding image

.conf

The .conf file is located in the /etc/apache2/sites-available/ directory.

RewriteEngine On
RewriteRule (quit$)|(restart$)  /index.html

ProxyPassMatch (/$)|(.png$)|(.html$)|(.htm$)|(.ico$)|(.js$) !
ProxyPass / http://localhost:8000/
ProxyPassReverse / http://localhost:8000/

This snippet blocks the /quit and /restart petitions that would shut-down or restart the Application Server. http://localhost:8000/quit will still work, so a systems administrator can manually shut-down or restart the Application Server(s). Schema bot will restart the Application Server(s) when needed.

The Web Server will return the index.html, schema.js, external_link.png and favicon.ico directly.

The Web Server will forward all other petitions to the Application Server at http://localhost:8000/

** TODO: Load balance Apache to different ports