Cloud Wiki uses a fairly simplistic web server for its content, Python's BaseHTTPServer. While BaseHTTPServer is simple, elegant and efficient for our uses, it does not protect itself from slow clients, either malicious or just obnoxious, and it does not provide certain niceties like compressing output.
While it is certainly possible to add this functionality to BaseHTTPServer, it is a lot of work for Cloud Wiki's developers, and there is a simpler solution available on most web servers that would require this sort of functionality: Apache 2's Reverse Proxying functionality.
Apache 2 provides mod_deflate, which can compress served content dynamically; content compression is one of those things that every web server should be doing, but probably doesn't. It can reduce your bandwidth bill in half, improves response time and only costs a pittance in CPU time and memory to do. Apache 2 can even be configured to not compress pre-compressed data, like images.
Apache 2 also provides mod_proxy, which, incorrectly configured can be a security risk, which can allow the Apache server to delegate incoming requests to other web server processes. Since Cloud Wiki does not use the CGI model, reverse proxying is often your best bet for making it appear a part of your existing server.
It is really beyond this manual's scope to explain Apache's configuration language, so you must be familiar with Apache 2's configuration already. This is just an example, and certainly not guaranteed to mesh well with your personal setup.
This loads the required modules. If you have compiled them in, that's good! Otherwise, you'll need this..
# Used to ensure that we compress output. LoadModule deflate_module modules/mod_deflate.so # Used to reverse proxy to long running web services. LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so
This will ensure that noone can use your proxy to cover their tracks while attacking other sites..
ProxyRequests Off
But this will open up your reverse proxying functionality for the redirection rules you specify, later..
<Proxy *> Order deny,allow Allow from all </Proxy>
And this will actually map the /cloud URI on your server to your Cloud Wiki server running locally on port 2080. This doesn't have to be on the same server, you can easily move your wiki off to its own application server if you want. (And, if you do, you really want a more powerful wiki, like MediaWiki.. Most of this should work for them, too.)
ProxyPass /cloud http://127.0.0.1:2080
You will want to configure your Wiki to with a base URL, using the following command
cloud-wiki -d<path-to-wiki-database> config base-url:/cloud
This will tell the wiki to prefix all wiki URL's with /cloud. In an ideal world, we would use nothing but relative-addressed links in Cloud Wiki, but it's easier to just use a base URL.
This page is a part of the cloud wiki manual.