################
Web Server Notes
################
:Author: Dimitry Dukhovny
.. contents::
Using Apache2 with SSL as a Proxy for an application service
============================================================
Your web server, **serverA**, stands in front of your app server, **serverB**. It serves two distinct services as **URIone** and **URItwo**.
.. code-block:: apache
:linenos:
:caption:
/etc/httpd/conf.d/020-ssl.conf or /etc/apache2/sites-available/020-ssl.conf
# Make sure we use SSL/TLS...
LoadModule ssl_module modules/mod_ssl.so
# ...and listen on the expected port for HTTPS
Listen 443
# Activate the features we will use
RewriteEngine On
SSLPRoxyEngine On
SSLProxyCheckPeerCN Off
# Starting in Apache 2.5...
SSLProxyCheckPeerName Off
ProxyRequests Off
RequestHeader unset Accept-Encoding
RequestHeader unset Authorization
RewriteRule ^/URIone$ /URIone/ [R]
ProxyPass https://serverB/URIone keepalive=on
ProxyPassReverse https://serverB/URIone
ProxyPassReverseCookieDomain serverB serverA
RewriteRule ^/URItwo$ /URItwo/ [R]
ProxyPass https://serverB/URItwo keepalive=on
ProxyPassReverse https://serverB/URItwo
ProxyPassReverseCookieDomain serverB serverA
# Text substitutions for generated links
Substitute "s|http://serverB|https://serverA|n"
Substitute "s|https://serverB|https://serverA|n"
Substitute "s|https://serverB:443|https://serverA|n"
# Deal with MSIE
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
# Log appropriately
CustomLog logs/ssl_request_log "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
Receiving uploads with a web form using PERL CGI
================================================
This script is a hodgepodge of simple solutions from all over the Internet. The original author is lost to time, but I suspect it was an early recipe from Rich "DrBacchus" Bowen's *Apache Cookbook*.
:download:`Download upload.cgi `
.. literalinclude:: code_samples/upload.cgi
:linenos:
:caption: upload.cgi
:language: perl