<?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>On Tech and Software &#187; apache</title>
	<atom:link href="http://jmgtan.com/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://jmgtan.com</link>
	<description>Random thoughts on technology, ventures, algorithms, frameworks, gadgets and THE MAN</description>
	<lastBuildDate>Fri, 02 Jul 2010 11:14:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Apache 2: Self-Signed Certificates</title>
		<link>http://jmgtan.com/2009/05/12/apache-2-self-signed-certificates/</link>
		<comments>http://jmgtan.com/2009/05/12/apache-2-self-signed-certificates/#comments</comments>
		<pubDate>Tue, 12 May 2009 08:30:50 +0000</pubDate>
		<dc:creator>Jan Michael Tan</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://jmgtan.com/?p=129</guid>
		<description><![CDATA[Self-signed certificates are very useful when doing testing on your local machine. The following was tested using a unix based environment. Generate the Key and Certificate First we generate the private key openssl genrsa -des3 -out server.key 1024 Then we create a certificate signing request openssl req -new -key server.key -out server.csr We make sure [...]]]></description>
			<content:encoded><![CDATA[<p></p>
<p>Self-signed certificates are very useful when doing testing on your local machine. The following was tested using a unix based environment.</p>
<p><span id="more-129"></span></p>
<p><strong>Generate the Key and Certificate</strong></p>
<p><em>First we generate the private key</em></p>
<pre class="brush: bash;">

openssl genrsa -des3 -out server.key 1024
</pre>
<p><em>Then we create a certificate signing request</em></p>
<pre class="brush: bash;">

openssl req -new -key server.key -out server.csr
</pre>
<p><em>We make sure that everytime we start the apache server, we don&#8217;t have to type the passphrase</em></p>
<pre class="brush: bash;">

cp server.key server.key.org

openssl rsa -in server.key.org -out server.key
</pre>
<p><em>Lastly we self-sign the certificate</em></p>
<pre class="brush: bash;">

openssl x509 -req -days 365 -in server.csr -signkey server.key -out               server.crt
</pre>
<p><strong>Configure the Apache Server</strong></p>
<p>Edit your apache&#8217;s httpd.conf and uncomment the following lines (just search it in the file)</p>
<pre class="brush: bash;">

LoadModule ssl_module modules/mod_ssl.so

#PATH MAY DIFFER TO YOUR SETUP

Include conf/extra/httpd-ssl.conf
</pre>
<p>Next edit your apache&#8217;s httpd-ssl.conf, search for the following configuration item: SSLCertificateFile &amp; SSLCertificateKeyFile, change it to where your server.crt and server.key files are located respectively (absolute path!)</p>
<p>Finally if you&#8217;re using VirtualHost it is important to declare two NameVirtualHost (one for port 80 and port 443). Example:</p>
<pre class="brush: xml;">

NameVirtualHost 127.0.0.1:80

NameVirtualHost 127.0.0.1:443

&lt;VirtualHost 127.0.0.1:80&gt;

ServerName local.example.com

DocumentRoot /path/to/your/example.com/www

&lt;/VirtualHost&gt;

&lt;VirtualHost 127.0.0.1:443&gt;

ServerName local.example.com

DocumentRoot /path/to/your/example.com/www

SSLEngine on

SSLCertificateFile /path/to/your/server.crt

SSLCertificateKeyFile /path/to/your/server.key

&lt;/VirtualHost&gt;
</pre>
<p>Save and restart your Apache server!</p>
<p></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fjmgtan.com%2F2009%2F05%2F12%2Fapache-2-self-signed-certificates%2F&amp;linkname=Apache%202%3A%20Self-Signed%20Certificates"><img src="http://jmgtan.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://jmgtan.com/2009/05/12/apache-2-self-signed-certificates/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
