<?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>Chris Mallinson &#187; Hosting</title>
	<atom:link href="http://mallinson.ca/cat/hosting/feed/" rel="self" type="application/rss+xml" />
	<link>http://mallinson.ca</link>
	<description>Technological Things</description>
	<lastBuildDate>Fri, 07 May 2010 06:09:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0-beta2</generator>
		<item>
		<title>Apache, mod_rewrite and Sexy URLs</title>
		<link>http://mallinson.ca/post/mod_rewrite/</link>
		<comments>http://mallinson.ca/post/mod_rewrite/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 08:10:40 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[The Web]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[URL Rewriting]]></category>
		<category><![CDATA[Web Servers]]></category>

		<guid isPermaLink="false">http://mallinson.ca/?p=147</guid>
		<description><![CDATA[99% of the people who visit a web site don&#8217;t care how it works, or how it was built. They don&#8217;t care if you&#8217;re using ColdFusion or PHP, and they don&#8217;t care if you&#8217;re using post or get variables. The remaining one percent comprises some techie types like me, and probably you, and some people with less than honourable intentions. [...]]]></description>
			<content:encoded><![CDATA[<p>99% of the people who visit a web site don&#8217;t care how it works, or how it was built. They don&#8217;t care if you&#8217;re using ColdFusion or PHP, and they don&#8217;t care if you&#8217;re using post or get variables. The remaining one percent comprises some techie types like me, and probably you, and some people with less than honourable intentions. For members of the latter group, you don&#8217;t WANT them to know what type of technology you use.</p>
<p>This is a good argument for URL rewriting, as is the fact that semantic and descriptive URLs assist in search engine ranking, and general usability. I rewriting my URLs because I like the way they look. I think a website looks much more polished when the URLs are descriptive, free of variable/value pairs, and as short possible.<br />
<span id="more-147"></span><br />
Since I tend to use Apache with most of the sites I work on, and I recommend you do the same wherever possible, I&#8217;m only going to talk about using mod_rewrite, an almost universal Apache module for URL rewriting. There are similar solutions available for other web servers. I&#8217;ll show you an example use of mod_rewrite for a skeleton example site. I&#8217;ll provide all the code as well so you can play around with a working example. Please remember that this is just a quick overview of the mod_rewrite functions, and how they can be used with ColdFusion. It is always a good idea to lock down your Apache install as much  as possible for public sites, and it should also be noted that using mod_rewrite does involve a small performance hit.</p>
<h3>Turn on mod_rewrite</h3>
<p>You may already have the mod_rewrite module activated in Apache. It&#8217;s simple to check. You need to be familiar with editing the httpd.conf file for your Apache install.</p>
<p>Make sure the following line in your <b>httpd.conf</b> file is NOT commented out (it commented out by default).</p>
<pre lang="” htaccess”">LoadModule rewrite_module libexec/apache2/mod_rewrite.so</pre>
<p>Another thing you need to be sure of is that the AllowOverride directive is turned on for your web root.  The default settings in apache is &#8220;none&#8221;.  This needs to be changed to &#8220;all&#8221; to enable the .htaccess file to change Apache settings.  This can be found either in the default  section it can be set on a per directory basis.</p>

<div class="wp_codebox"><table><tr id="p1473"><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p147code3"><pre class="htaccess" style="font-family:monospace;">&lt;directory /&gt;
    Options FollowSymLinks
    AllowOverride All
    Order deny,allow
    Deny from all
&lt;/directory&gt;</pre></td></tr></table></div>

<p>If you need to make a change, remember to stop and restart Apache for your changes to take effect.</p>
<h3>Looking at the Rewrite Directives</h3>
<p>Here&#8217;s my example .htaccess file. This file goes in your web root. I&#8217;ll go through it step by step in a minute.  One important prerequisite for understanding the mod_rewrite file is that you will need to have a good understanding of regular expressions in order to write your own rules.</p>

<div class="wp_codebox"><table><tr id="p1474"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code" id="p147code4"><pre class="htaccess" style="font-family:monospace;">RewriteEngine on
&nbsp;
RewriteRule ^$ app/index.cfm [L]
RewriteRule ^(contact|about|blog|categories)/?$ app/$1.cfm [L]
RewriteRule ^demos/([0-9]*)/?$ app/content/demo$1/index.cfm [L]
RewriteRule ^c/([a-zA-Z0-9\-\_]{1,30})/?$ app/categories.cfm?cat=$1 [L]
RewriteRule ^([a-zA-Z0-9\-\_]{1,30})/?$ app/post.cfm?key=$1 [L]
&nbsp;
RewriteCond %{HTTP_USER_AGENT} MSIE\s(\d)\.(?!.*Opera)
RewriteCond %1 &amp;lt;=6
RewriteRule ^(/[a-zA-Z0-9\-\_\.])*assets/css/main\.css$ css/main-ie.css [L]
&nbsp;
RewriteRule ^(/[a-zA-Z0-9\-\_\.])*assets/js/jquery\.js$ js/jquery/jquery-1.3.2.min.js [L]
RewriteRule ^(/[a-zA-Z0-9\-\_\.])*assets/css/main\.css$ css/main.css [L]</pre></td></tr></table></div>

<p><b title="RewriteEngine on">Line 1</b> is important, as it activates the Rewrite engine.</p>
<p>The rewriting starts on <b title="RewriteRule ^$ app/index.cfm [L]">line 3</b>. I like to keep my main site files in a folder called &#8220;app&#8221; in my web root, so the first line rewrites a call to the web root to &#8220;/app/index.cfm&#8221;</p>
<p><b title="RewriteRule ^(contact|about|blog|categories)/?$ app/$1.cfm [L]">Line 4</b> redirects a few of the regular top-level pages in the site to their respective locations in my directory structure. /contact to /app/contact.cfm, /about to app/about.cfm, etc.</p>
<p><b title="RewriteRule ^demos/([0-9]*)/?$ app/content/demo$1/index.cfm [L]">Line 5</b> redirects links to demos I included on the site.  /demo/1 goes to /app/demo1/index.cfm, /demo/2 goes to /app/demo2/index.cfm, and so on.</p>
<p><b title="RewriteRule ^c/([a-zA-Z0-9\-\_]{1,30})/?$ app/categories.cfm?cat=$1 [L]">Line 6</b> is for the categories pages for the blog that is part of the site.  For example, the link /c/cars would get redirected to /app/categories.cfm?cat=cars.</p>
<p><b title="RewriteRule ^([a-zA-Z0-9\-\_]{1,30})/?$ app/post.cfm?key=$1 [L]">Line 7</b> will take any remaining link that does not contain a &#8220;sub-directory&#8221; and assumes it is a blog post.  The links would be forwarded like this:  /apache-url-forwarding would be rewritten as /app/post.cfm?key=apache-url-forwarding. This allows you to use the key to lookup a blog post and display it for the reader.  These short titles are usually called &#8220;slugs&#8221; by blogging software and are unique titles given to your posts for use in search engine friendly URLs.</p>
<p><b title="RewriteCond %{HTTP_USER_AGENT} MSIE\s(\d)\.(?!.*Opera)  -  RewriteCond %1 &lt;=6">Line 9 and 10</b> are conditional, and serve the purpose of rewriting the CSS file differently for Internet Explorer 6 and below than it is for the rest of the browsers.  You can see that <b title="RewriteRule ^(/[a-zA-Z0-9\-\_\.])*assets/css/main\.css$ css/main-ie.css [L]">line 11</b> directs calls to the main CSS file to an IE6 specific file.  The preceding rewrite conditions apply to the rewrite rule that immediately follows the condition.</p>
<p><b title="RewriteRule ^(/[a-zA-Z0-9\-\_\.])*assets/js/jquery\.js$ js/jquery/jquery-1.3.2.min.js [L]">Line 13</b> rewrites the CSS file for the remaining browsers.  You may wonder why I bother rewriting the URL of the CSS file.  I like to keep several sets of CSS files on hand &#8211; sometimes different themes, sometimes different versions, and sometimes just a specific set of CSS files for development only.  Rewriting the CSS URLs allows me to switch between the files with ease without touching my application code at all.</p>
<p><b title="RewriteRule ^(/[a-zA-Z0-9\-\_\.])*assets/css/main\.css$ css/main.css [L]">Line 14</b> rewrites the call to an external JavaScript file &#8211; in this case jQuery.  This is helpful for managing versions of a jQuery library.  In this case, I&#8217;m just calling a file called jquery.js, but I&#8217;m linking to a minified version of jquery 1.3.2.</p>
<h3>The Code</h3>
<p>I&#8217;ve gone through this pretty quickly, and without a ton of detail, but I&#8217;ve included the code all zipped up nicely for you to try it yourself. Stick the whole directory structure in your development web root, and give it a try. Remember to turn on mod_rewrite.</p>
<p><a href="http://cf.mallinson.ca/url_rewrite/">Working Example</a><br />
<a href="http://cf.mallinson.ca/url_rewrite.zip">Zipped Up Files</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mallinson.ca/post/mod_rewrite/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>A Cloudy Suggestion for Adobe</title>
		<link>http://mallinson.ca/post/thecloud/</link>
		<comments>http://mallinson.ca/post/thecloud/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 15:00:52 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[The Web]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[Railo]]></category>

		<guid isPermaLink="false">http://mallinson.ca/?p=150</guid>
		<description><![CDATA[There is a lot of buzz about &#8220;The Cloud&#8221; and I think it&#8217;s warranted. Every time someone gets a CFML engine running in a cloud environment, like the recent cloud successes involving Railo and Open BlueDragon, the community gets a little more interested. I&#8217;m sure there&#8217;s a way to get ColdFusion server, in certain deployments, [...]]]></description>
			<content:encoded><![CDATA[<p>There is a lot of buzz about &#8220;The Cloud&#8221; and I think it&#8217;s warranted. Every time someone gets a CFML engine running in a cloud environment, like the recent cloud successes involving <a href="http://corfield.org/blog/index.cfm/do/blog.entry/entry/CFML_in_the_Cloud">Railo</a> and <a href="http://www.mattwoodward.com/blog/index.cfm?event=showEntry&amp;entryId=69F67498-BDA6-41BD-A917C787A0EB8439">Open BlueDragon</a>, the community gets a little more interested. I&#8217;m sure there&#8217;s a way to get ColdFusion server, in certain deployments, to run in the cloud, but licensing issues would arise.<br />
<span id="more-150"></span><br />
At the Adobe MAX conference, last November, I was asked by several Adobe people about cloud computing, and if I, as a CF developer, was interested. I got the impression that they were either thinking about the possibility of allowing CF to run in the cloud, or worried that developers would jump to another language that would.</p>
<p>I have to admit that at the time, I didn&#8217;t think it would be something I needed to explore yet, but it&#8217;s getting there. I think that the cloud computing model will fit perfectly for the medium sized websites. Sites that occasionally spike, and get a large, but not CNN/Digg sized, amount of traffic.</p>
<p>There are already entire companies based on providing cloud solutions for Ruby, Python and PHP, among others.  CFML is behind on this, and although there are a bunch of good people working on rectifying that problem, we are going to need more.  I think Adobe could kill a couple of birds with one stone by offering a ColdFusion hosting environment to users, in a cloud-like configuration, for a regular hosting fee.  This would solve the licensing issue for those that want to deploy their CF apps in a cloud environment, and allow some companies that are wary of the costs to get in on the ground level, and see what ColdFusion has to offer.</p>
]]></content:encoded>
			<wfw:commentRss>http://mallinson.ca/post/thecloud/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Don&#039;t Host Static Assets</title>
		<link>http://mallinson.ca/post/static-assets/</link>
		<comments>http://mallinson.ca/post/static-assets/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 16:20:18 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[The Web]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Amazon S3]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://mallinson.ca/?p=121</guid>
		<description><![CDATA[Bandwidth concerns for web developers used to be centered around the user. I remember making sure every page loaded no more than about 30k worth of assets, just so dial-up users could see my sites in only a few seconds. Now that most users have fast connections, and the few people using dial-up are used [...]]]></description>
			<content:encoded><![CDATA[<p>Bandwidth concerns for web developers used to be centered around the user.  I remember making sure every page loaded no more than about 30k worth of assets, just so dial-up users could see my sites in only a few seconds.  Now that most users have fast connections, and the few people using dial-up are used to the wait, you can start thinking about how much data your server is pushing out rather than how much data your clients are pulling.  Those two numbers do not have to match.<br />
<span id="more-121"></span><br />
Most of us are using one of a few of the main JavaScript frameworks, and some of you even use CSS frameworks.  Either way, using JS or CSS frameworks means your clients are downloading code from you that is already on their computer &#8211; in their browser cache &#8211; courtesy of other sites using the same libraries.</p>
<p>This could be solved if we all started loading these frameworks from one place, and Google has provided a <a href="http://code.google.com/apis/ajaxlibs/">solution</a> that does just that.  Google hosts all the latest versions of the most popular JavaScript libraries, and keeps a few of the old versions if you need them.  You can load the files directly by pointing to the path of the file, or you can use Google&#8217;s loader scripts.</p>
<hr />
<h3>Google hosts the following JS Libraries</h3>
<ul>
<li>jQuery and jQueryUI</li>
<li>Prototype and Script.aculo.us</li>
<li>MooTools</li>
<li>Dojo</li>
<li>SWFObject</li>
<li>YUI (Yahoo! UI Library)</li>
</ul>
<hr />
<p>This has multiple benefits. First, it reduces the amount of bandwidth you are using with your host.  Second, unless you are really rich and like to throw money around, the Google servers are faster than yours, so your clients will load the files faster.  Third, your clients may not need to load the files at all.  As I mentioned earlier, the files may already be in their browser cache if they have visited a site that uses this technique.</p>
<p>But wait!  That&#8217;s not all.  JavaScript frameworks are the most obvious assets to offload to a faster host, since unless you are totally hard-core, you probably don&#8217;t modify them.  But there are other files that you may need to load that stay relatively static.  CSS is an obvious example, as is external JavaScript files that are not part of a framework.  I also know that some of you like to combine and compress your JS files for quick loading, and the contents of those files could be specific to your site.</p>
<p><img class="size-full wp-image-127" title="Amazon Web Services" src="http://chris.mallinson.ca/wp-content/uploads/2009/06/logo_aws.gif" alt="Amazon Web Services" width="164" height="60" align="left" style="border:5px solid #FFF;" /></p>
<p>There are good ways to offload these files as well.  The best way that I have found is the use of <a href="http://aws.amazon.com/">Amazon Web Services</a>.  Create yourself an account, read a little bit about it, and watch some tutorials.  There are some very sophisticated ways to host content on AWS, and some great ways to integrate the services with ColdFusion, but for hosting your static assets, you only need to upload your files, and use the generated URLs as the source for your files.  It&#8217;s not free, but it&#8217;s ridiculously cheap &#8211; far cheaper than any web hosting company could provide.</p>
]]></content:encoded>
			<wfw:commentRss>http://mallinson.ca/post/static-assets/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>My Mac Mini @ Macminicolo</title>
		<link>http://mallinson.ca/post/macminicolo/</link>
		<comments>http://mallinson.ca/post/macminicolo/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 07:40:40 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Do It Yourself]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[The Web]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://cm.local/blogs/wordpress/?p=26</guid>
		<description><![CDATA[There are thousands of web hosting / co-location services out there, but as far as I know, there are none that will co-locate a server that can be shipped in a shoebox, and will treat it like it belongs in a rack, next to the big boys. Macminicolo.net does just that.  You send them a [...]]]></description>
			<content:encoded><![CDATA[<p>There are thousands of web hosting / co-location services out there, but as far as I know, there are none that will co-locate a server that can be shipped in a shoebox, and will treat it like it belongs in a rack, next to the big boys.</p>
<p><a href="http://www.macminicolo.net/">Macminicolo.net</a> does just that.  You send them a Mac Mini (or buy one from them at the going rate) and they will hook it up to a smoking fast connection in a managed facility.  You get full access to your machine, and can even (optionally) manage the power supply remotely.</p>
<p>Worried a Mac Mini would not be able to keep up with your needs?  You&#8217;d be surprised.  They perform very well under load, especially maxed out with RAM.  In addition to being able to host unlimited domains yourself, it&#8217;s a great way to keep remote secure backups, manage an SVN repository, or just to use as a personal file server.</p>
<p>I&#8217;ve been using their service for about a year, and I&#8217;m extremely satisfied.</p>
]]></content:encoded>
			<wfw:commentRss>http://mallinson.ca/post/macminicolo/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
