No activity today, make something!
tiddlyweb Using Mod Proxy

20160313160648 cdent  

In some setups, it may be useful to use Apache as a proxy server to some other web server that is running TiddlyWeb, for example gunicorn. This may help save memory and can also provide ways to load balance and scale your application. One option is to use Apache to serve up static content while the proxied server serves up the dynamic content created by TiddlyWeb.

To get started first ensure that your Apache has mod_proxy enabled. On Ubuntu (and perhaps other similar systems) you can run:

a2enmod proxy_http

This will enable settings in your apache config to load the proxy module and set a reasonable configuration. If you need to do this by hand please see the the mod proxy docs.

Create an instance, setting server_host to the external IP and port.

Launch the instance with gunicorn or any other WSGI server, binding to a local only interface (e.g. localhost:8080). If you wish to have your TiddlyWeb in a subdirectory (e.g. /wiki) set server_prefix to that subdirectory.

Configure apache to proxy a virtual host or direcory to the TiddlyWeb server:

<VirtualHost *>
    ServerName dev.peermore.com
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
    ProxyPreserveHost On
    # this assumes a server_prefix of /wiki
    ProxyPass /wiki/ http://0.0.0.0:8080/
    ErrorLog /var/log/apache2/dev.peermore.com-error.log
    CustomLog /var/log/apache2/dev.peermore.com-access.log combined
</VirtualHost>

Restart apache. If things are configured correctly you should see requests to Apache being passed on to the TiddlyWeb server.