<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Lackhead.org &#187; apache</title>
	<atom:link href="http://www.lackhead.org/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lackhead.org</link>
	<description>The irascible ramblings of some guy named Chad</description>
	<lastBuildDate>Sun, 28 Aug 2011 16:19:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Confluence, mod_proxy, and SSL (oh my!)</title>
		<link>http://www.lackhead.org/2009/10/confluence-mod_proxy-and-ssl-oh-my/</link>
		<comments>http://www.lackhead.org/2009/10/confluence-mod_proxy-and-ssl-oh-my/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 03:47:24 +0000</pubDate>
		<dc:creator>lackhead</dc:creator>
				<category><![CDATA[Computer-schmuter]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[computer]]></category>
		<category><![CDATA[confluence]]></category>
		<category><![CDATA[mod_proxy]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[tomcat]]></category>
		<category><![CDATA[wiki]]></category>

		<guid isPermaLink="false">http://www.lackhead.org/?p=280</guid>
		<description><![CDATA[Whew! I spent a looooong time today futzing around trying to get Confluence to work with SSL and mod_proxy, and after hours combing the Internet for hope, I did stumble upon a few blog comments here and there, which stitched &#8230; <a href="http://www.lackhead.org/2009/10/confluence-mod_proxy-and-ssl-oh-my/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Whew!  I spent a <em>looooong</em> time today futzing around trying to get <a href="http://www.atlassian.com/software/confluence/">Confluence</a> to work with SSL and <a href="http://httpd.apache.org/docs/2.0/mod/mod_proxy.html">mod_proxy</a>, and after hours combing the Internet for hope, I did stumble upon a few blog comments here and there, which stitched together provided me with the pretty simple solution I was looking for. Granted, I&#8217;m pretty new to both Confluence and Tomcat, so perhaps that hindered me.  But I also couldn&#8217;t find anything succinct out there that talked about my situation, hence, this posting. </p>
<p>Here&#8217;s my situation- I have an <a href="http://www.apache.org/">Apache</a> server that hosts a number of virtual hosts, including SSL and non-SSL sites. I had recently purchased  <a href="http://www.atlassian.com/software/confluence/">Confluence</a> to provide wiki services for me, my son, and perhaps a few others.  I wanted to tuck Confluence behind Apache, and read up on Confluence&#8217;s web site about how to use  <a href="http://httpd.apache.org/docs/2.0/mod/mod_proxy.html">mod_proxy</a> to get Apache to front-end Confluence.  This turned out to be very simple, and in a matter of minutes I had Confluence up and running.  For those of you who might be interested in doing this, here is a brief overview of the process:</p>
<ol>
<li> Add a virtual host to apache, either named or by IP, with the following configuration:
<pre>
    # This is just passing a proxy to a localhost server
    ProxyRequests Off
    ProxyPreserveHost On

    &lt;Proxy *&gt;
         Order deny,allow
         Allow from all
    &lt;/Proxy&gt;

    ProxyPass / http://localhost:8080/&lt;whatever-space-you-have-confluence-in&gt;
    ProxyPassReverse / http://localhost:8080/&lt;whatever-space-you-have-confluence-in&gt;

    &lt;Location /&gt;
        Order allow,deny
        Allow from all
    &lt;/Location&gt;
</pre>
</li>
<li> Configure Confluence to only listen on to localhost, which is as easy as adding a line to the <code>Connector</code> stanza in the <em>server.xml</em> file that reads <code>address="127.0.0.1"</code>.
</li>
</ol>
<p>Really, that&#8217;s it. This way, Tomcat is not listening on any port that the outside world can see, which means only a service running on that box (apache) can talk to it. </p>
<p>This was all fine and dandy, but I really wanted to get this working over HTTPS so that I could rest a bit easier knowing that my information would be traversing the wild and dangerous Internet encrypted (authentication-related information and everything else). So, the rough idea was that my browser would open up an SSL connection with apache over port 443, and it would proxy to Tomcat via localhost, the later of which didn&#8217;t need to be encrypted because it was confined to my box and wouldn&#8217;t come in contact with the Internet. </p>
<p>Reading up on this turned up a dearth of good information.  Or, at least a nice general summary of what to do. Here&#8217;s what I wound up doing:</p>
<ol>
<li> Change your Apache virtual host to use SSL.  For me, that meant carving out another virtual network interface on my box and assigning it its own IP address. Once that&#8217;s done, you can add <code>Listen</code> directives to get apache to listen on the particular IP:port you are looking for:
<pre>
Listen xxx.xxx.xxx.xxx:443
</pre>
<p>Once that&#8217;s done, you can add the SSL directives to your VirtualHost. This is what my configuration wound up looking like (I removed superfluous entries like logging, etc.):</p>
<pre>
 &lt;VirtualHost xxx.xxx.xxx.xxx:443&gt;
    ServerAdmin &lt;youradminemailaddress&gt;
    ServerName &lt;yourservername&gt;           

    # SSL Setup
    SSLEngine On
    # Allow out medium or high key lengths
    SSLCipherSuite HIGH:MEDIUM
    # Here I am allowing SSLv3 and TLSv1, I am NOT allowing the old SSLv2.
    SSLProtocol all -SSLv2
    # Server Certificate:
    SSLCertificateFile /path/to/public_cert.pem
    # Server Private Key:
    SSLCertificateKeyFile /path/to/private_key.pem
    # Server Certificate Chain:
    SSLCertificateChainFile /path/to/ca_cert.pem
    # Certificate Authority (CA):
    SSLCACertificateFile /path/to/ca_cert.pem

    # This is just passing a proxy to a localhost server
    ProxyRequests Off
    ProxyPreserveHost On

    &lt;Proxy *&gt;
         Order deny,allow
         Allow from all
    &lt;/Proxy&gt;

    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/

    &lt;Location /&gt;
        Order allow,deny
        Allow from all
    &lt;/Location&gt;

&lt;/VirtualHost&gt;
</pre>
<p>This really isn&#8217;t any big change from before, just SSL-izing it as you would any host.
</li>
<li> Now, I also had to make a change to the <em>server.xml</em> that added more options to the  <code>Connector</code> stanza. This is what that whole stanza wound up looking like:
<pre>
       &lt;Connector className=&quot;org.apache.coyote.tomcat4.CoyoteConnector&quot; port=&quot;8080&quot; minProcessors=&quot;5&quot;
                   maxProcessors=&quot;75&quot;
                   proxyPort=&quot;443&quot; scheme=&quot;https&quot; proxyName=&quot;wiki.lackhead.org&quot;
                   address=&quot;127.0.0.1&quot;
                   enableLookups=&quot;false&quot; redirectPort=&quot;8443&quot; acceptCount=&quot;10&quot; debug=&quot;0&quot; connectionTimeout=&quot;20000&quot;
                   useURIValidationHack=&quot;false&quot; URIEncoding=&quot;UTF-8&quot;/&gt;
</pre>
<p>The important line is the one with the proxy information.  This tells Tomcat to believe that all incoming requests into your server on port 443, even though hopping through the proxy changes that information. </p>
<p>Given what I traipsed up on the Internet, I had various pieces of this and spent a lot of time trying to figure out what was going on when I would hit the URL, it would connect with the server, but nothing would ever come back. Not really rocket science, but without all the pieces it just wasn&#8217;t working. Now it is. <img src='http://www.lackhead.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>-c</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lackhead.org/2009/10/confluence-mod_proxy-and-ssl-oh-my/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>

