Running Pootle on Apache
Pootle 1.2: mod_proxy
This is the preferred way to run Pootle 1.2. Keep in mind that this is not the only way to run Pootle. For Pootle 1.3, using mod_python or mod_wsgi is advisable.
A Pootle Web-translation server is made up of static and dynamic content. By default Pootle serves all content, for low-latency purposes it is better to get Apache to serve the content that does not change, the static content. It is just the issue of low latency and making the translation experience more interactive that calls you to proxy through Apache. The following steps show you how to setup Pootle to proxy through Apache.
Most of the documentation below assumes that you are using Apache 2 and that your configuration is stored in /etc/apache2 with the configuration as is common in Debian based systems. Furthermore it assumes that the Pootle server is running on the same host as Apache and is listening on port 8080. On other systems, the configuration might be in /etc/httpd/ with module configuration in /etc/httpd/modules.d/ or similar.
To begin with, you might need to enable mod_proxy on Apache. First ensure that mod_proxy is available by checking for the file /etc/apache2/mods-available/proxy.conf. To ensure that all the modules are enabled, make sure that the necessary proxy modules are linked from /etc/apache2/mods-enabled/. You will probably need the following modules:
- proxy.conf
- proxy.load
- proxy_http.load
Now authorise proxy requests in proxy.conf otherwise you could end up with an unreachable web site and messages such as client denied by server configuration: proxy:http://localhost:8080/ in your log files:
<Proxy localhost:8080> Order Allow,Deny Allow from localhost </Proxy>
Here is an example httpd.conf to create a virtual host for Pootle and also proxy through from Apache to the Pootle port. This might be suitable for putting in /etc/apache2/sites-available/, /etc/httpd/conf/vhosts.d/ or similar.
<VirtualHost *:*>
ServerName pootle.locamotion.org
ServerAlias pootle.sjsoft.com
ServerAlias www.wordforge.org
ServerAlias wordforge.org
ProxyPass /images !
ProxyPass /js !
ProxyPass /pootle.css !
ProxyPass /favicon.ico !
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
<Directory proxy:http://localhost:8080/*>
Order deny,allow
Allow from all
</Directory>
ErrorLog logs/pootle-error_log
CustomLog logs/pootle-access_log common
# Fallback for static html content
DocumentRoot "/usr/lib/python2.4/site-packages/Pootle/html/"
<Directory "/usr/lib/python2.4/site-packages/Pootle/html/">
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
With Apache 1.3, the ProxyPass directive does not support !. You must replace these ! by a url (e.g. Proxypass /images http://localhost/pootle/images).
Pootle 1.3: mod_python or mod_wsgi
Running Pootle under Apache requires mod_python or mod_wsgi.
You need to extract Pootle in a directory accessible to the apache user.
Prepare the Pootle database as described in installation_1.3beta
Make sure Apache has read access to all of Pootle's files and write access to the dbs and po subdirectories.
Depending on which apache module you'll use to deploy pootle, you need to add the relevant portion to your apache's configuration.
mod_wsgi
WSGIScriptAlias /pootle /var/www/Pootle/wsgi.py Alias /pootle/html /var/www/Pootle/html <Directory /var/www/Pootle/html> Order deny,allow Allow from all </Directory>
mod_python
<Location "/pootle">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE pootle.settings
PythonOption django.root /pootle
PythonPath "['/var/www/Pootle', '/var/www/Pootle/local_apps', '/var/www/Pootle/external_apps'] + sys.path"
PythonInterpreter pootle
PythonDebug On
</Location>
<Location "/pootle/html">
SetHandler None
</Location>
<Directory /var/www/Pootle/html>
Order deny,allow
Allow from all
</Directory>
more info regarding Django on mod_python.
Note: If you run Pootle at the root of your web server, do not set PythonOption django.root to /. Rather, do not set that option at all (comment out or delete the entire line from the config).