====== Setting up a reverse proxy for the httpd web server ====== Turns out it was not as easy as it may seem. This page describes things to do in your Linux host. ===== Installation ===== Install apache2 with mod_proxy, mod_proxy_html and mod_proxy_http (installed by default in Raspbian) Enable mod_rewrite, mod_cache, mod_proxy, mod_proxy_http, mod_proxy_html (e.g. using ''a2enmod rewrite cache proxy proxy_http proxy_html'') ===== Configuration ===== Use a2ensite. Throttle the Apache server to match to ITS server: # ITS can really only handle one connection at a time! MaxRequestsPerChild 1 ThreadsPerChild 1 MaxClients 1 Basic VirtualHost stuff: ServerAdmin victor@up.update.uu.se ServerSignature off ProxyRequests off ServerName up.update.uu.se ProxyPreserveHost On ErrorLog ${APACHE_LOG_DIR}/up-error.log CustomLog ${APACHE_LOG_DIR}/up-access.log combined LogLevel error Optional: error documents for when the ITS server fails/crashes: Alias /its-error/ "/home/klh10/its/apache-errors/" ProxyPass /its-error/ ! ProxyErrorOverride on ErrorDocument 503 /its-error/503.html ErrorDocument 404 /its-error/404.html Optional(?): caching CacheEnable disk / Optional: avoid robots which don't seem to respect robots.txt # Forbid the darn Baidu robot which doesn't respect robots.txt! And the Page2RSS thing which also doesn't, and connects every 2 minutes RewriteEngine on RewriteCond %{HTTP_USER_AGENT} ^.*Baiduspider [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^.*Page2RSS [NC] RewriteRule .* - [L,F] The real stuff: the proxy ProxyPass http://its-up.update.uu.se/ nocanon max=1 disablereuse=on retry=0 timeout=10 connectiontimeout=5 ProxyPassReverse http://its-up.update.uu.se/ # ITS only handles HTTP 1.0 and no keepalive SetEnv force-proxy-request-1.0 1 SetEnv proxy-nokeepalive 1 Order allow,deny Allow from all