<?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>langui.sh &#187; apache</title>
	<atom:link href="http://langui.sh/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://langui.sh</link>
	<description>Fun hacks, WP plugins, photography, and PKI junk.  Languishing since 2008.</description>
	<lastBuildDate>Tue, 17 Jan 2012 20:23:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>List All VHosts Currently Enabled In Apache</title>
		<link>http://langui.sh/2010/12/07/list-all-vhosts-currently-enabled-in-apache/</link>
		<comments>http://langui.sh/2010/12/07/list-all-vhosts-currently-enabled-in-apache/#comments</comments>
		<pubDate>Wed, 08 Dec 2010 01:45:10 +0000</pubDate>
		<dc:creator>Paul Kehrer</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[apache]]></category>

		<guid isPermaLink="false">http://langui.sh/?p=1457</guid>
		<description><![CDATA[<a href="http://langui.sh/2010/12/07/list-all-vhosts-currently-enabled-in-apache/" title="List All VHosts Currently Enabled In Apache"></a>If you want to get a list of all currently enabled virtualhosts in Apache, just type the following as root1: httpd -S You&#8217;ll get output that looks like this: port 80 namevhost somedomain.com (/etc/httpd/conf.d/somedomain.conf:1) port 80 namevhost another.com (/etc/httpd/conf.d/another.conf:1) port &#8230;<p class="read-more"><a href="http://langui.sh/2010/12/07/list-all-vhosts-currently-enabled-in-apache/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://langui.sh/2010/12/07/list-all-vhosts-currently-enabled-in-apache/" title="List All VHosts Currently Enabled In Apache"></a><p>If you want to get a list of all currently enabled virtualhosts in Apache, just type the following as root<sup class='footnote'><a href='#fn-1457-1' id='fnref-1457-1'>1</a></sup>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">httpd <span style="color: #660033;">-S</span></pre></div></div>

<p>You&#8217;ll get output that looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">port 80 namevhost somedomain.com (/etc/httpd/conf.d/somedomain.conf:1)
port 80 namevhost another.com (/etc/httpd/conf.d/another.conf:1)
port 80 namevhost test.com (/etc/httpd/conf.d/test.conf:1)
port 80 namevhost testing.com (/etc/httpd/conf.d/testing.conf:1)
port 80 namevhost fqdn.com (/etc/httpd/conf.d/fqdn.conf:1)</pre></div></div>

<p>Each line tells you port, type, the domain, and the conf file (and line) it&#8217;s defined in.  A very simple command, but one I forget all the time.</p>
<div class='footnotes'>
<div class='footnotedivider'></div>
<ol>
<li id='fn-1457-1'>substitute apache2ctl for httpd if you&#8217;re in Ubuntu/Debian <span class='footnotereverse'><a href='#fnref-1457-1'>&#8617;</a></span></li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://langui.sh/2010/12/07/list-all-vhosts-currently-enabled-in-apache/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>SSL VHosting On The Same IP (aka SNI)</title>
		<link>http://langui.sh/2009/11/03/ssl-vhosting-on-the-same-ip-aka-sni/</link>
		<comments>http://langui.sh/2009/11/03/ssl-vhosting-on-the-same-ip-aka-sni/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 21:01:54 +0000</pubDate>
		<dc:creator>Paul Kehrer</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[sni]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://langui.sh/?p=747</guid>
		<description><![CDATA[<a href="http://langui.sh/2009/11/03/ssl-vhosting-on-the-same-ip-aka-sni/" title="SSL VHosting On The Same IP (aka SNI)"></a>Server Name Indication (SNI), an extension to TLS, allows browsers that support it to connect to SSL hosts that do not have dedicated IPs (much like standard http virtual hosting has worked for years). This extension, however, must be supported &#8230;<p class="read-more"><a href="http://langui.sh/2009/11/03/ssl-vhosting-on-the-same-ip-aka-sni/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://langui.sh/2009/11/03/ssl-vhosting-on-the-same-ip-aka-sni/" title="SSL VHosting On The Same IP (aka SNI)"></a><p>Server Name Indication (SNI), an extension to TLS, allows browsers that support it to connect to SSL hosts that do not have dedicated IPs (much like standard http virtual hosting has worked for years).  This extension, however, must be supported on both the server and client side.  Microsoft has not yet chosen to support it (maybe IIS 8?), but the Apache project did with the 2.2.12 release.  Recently, Ubuntu 9.10 Server became the first server distribution to ship with Apache and OpenSSL built with the appropriate flags, so if you&#8217;d like to follow along you can use a 9.10 VM.</p>
<p>In the ideal case everything is the same as a regular vhost, but you&#8217;ll first need to enable SSL.  On Ubuntu this requires you to run <b>a2enmod</b> and type &#8220;ssl&#8221;.  After that you&#8217;ll need to add</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">NameVirtualHost</span> *:<span style="color: #ff0000;">443</span></pre></div></div>

<p>to the root conf, then make your VirtualHost much like a normal one.  A very basic pair of vhosts is seen below.</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">&lt;<span style="color: #000000; font-weight:bold;">VirtualHost</span> *:<span style="color: #ff0000;">443</span>&gt;
	<span style="color: #00007f;">ServerAdmin</span> webmaster@localhost
&nbsp;
	<span style="color: #00007f;">DocumentRoot</span> /my/doc/root
	<span style="color: #00007f;">ServerName</span> mydomain.com
	<span style="color: #00007f;">SSLEngine</span> <span style="color: #0000ff;">On</span>
	<span style="color: #00007f;">SSLCertificateFile</span> /path/to/domain.crt 
	<span style="color: #00007f;">SSLCertificateKeyFile</span> /path/to/domain.key
&lt;/<span style="color: #000000; font-weight:bold;">VirtualHost</span>&gt;
&lt;<span style="color: #000000; font-weight:bold;">VirtualHost</span> *:<span style="color: #ff0000;">443</span>&gt;
	<span style="color: #00007f;">ServerAdmin</span> webmaster@localhost
&nbsp;
	<span style="color: #00007f;">DocumentRoot</span> /my/doc/root
	<span style="color: #00007f;">ServerName</span> mydomain2.com
	<span style="color: #00007f;">SSLEngine</span> <span style="color: #0000ff;">On</span>
	<span style="color: #00007f;">SSLCertificateFile</span> /path/to/domain2.crt 
	<span style="color: #00007f;">SSLCertificateKeyFile</span> /path/to/domain2.key
&lt;/<span style="color: #000000; font-weight:bold;">VirtualHost</span>&gt;</pre></div></div>

<p>These vhosts should be placed in different includes ideally, but it isn&#8217;t required.  If you just want to test with a self-signed certificate you can create one with</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl req <span style="color: #660033;">-new</span> <span style="color: #660033;">-nodes</span> <span style="color: #660033;">-keyout</span> mykey.key <span style="color: #660033;">-out</span> mycert.cer <span style="color: #660033;">-days</span> <span style="color: #000000;">3650</span> <span style="color: #660033;">-x509</span></pre></div></div>

<p>You&#8217;ll need to specify the domain name you want in the &#8220;Common Name&#8221; section.</p>
<p>Once you&#8217;ve got all this done you can restart apache and test it out!  If you test on a browser that doesn&#8217;t support SNI (IE on XP) you&#8217;ll get the SSL cert for the first vhost apache parses.  To disable accessing it on non-SNI hosts you can add</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">SSLStrictSNIVHostCheck <span style="color: #0000ff;">on</span></pre></div></div>

<p>to the root conf.  This will cause a 403 error for those browsers.</p>
<p>If you&#8217;d like to see an example implementation of SNI you can check out my IDN domains <a href="http://xn--j4h.ws">https://☢.ws/</a> and <a href="https://xn--k4h.ws/">https://☣.ws/</a>.  These sites are hosted on the same IP with different SSL certificates.  I have strict host checking turned on so visiting them with a non-SNI capable browser will result in a 403 error.<sup class='footnote'><a href='#fn-747-1' id='fnref-747-1'>1</a></sup></p>
<div class='footnotes'>
<div class='footnotedivider'></div>
<ol>
<li id='fn-747-1'>See the Wikipedia article about <a href="http://en.wikipedia.org/wiki/Server_Name_Indication">Server Name Indication</a> for more information on supported browsers. <span class='footnotereverse'><a href='#fnref-747-1'>&#8617;</a></span></li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://langui.sh/2009/11/03/ssl-vhosting-on-the-same-ip-aka-sni/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using memcached
Page Caching using memcached
Database Caching 7/24 queries in 0.010 seconds using memcached
Object Caching 507/535 objects using memcached

Served from: langui.sh @ 2012-02-04 13:33:34 -->
