<?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>pastbedti.me &#187; Hosting</title>
	<atom:link href="http://www.pastbedti.me/tag/hosting/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pastbedti.me</link>
	<description>About ruby, rails, postgresql and stuff....</description>
	<lastBuildDate>Wed, 01 Jun 2011 20:09:49 +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>Deploying a Sinatra app with Apache and Phusion Passenger a.k.a. mod_rack</title>
		<link>http://www.pastbedti.me/2009/11/deploying-a-sinatra-app-with-apache-and-phusion-passenger-a-k-a-mod_rack/</link>
		<comments>http://www.pastbedti.me/2009/11/deploying-a-sinatra-app-with-apache-and-phusion-passenger-a-k-a-mod_rack/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 22:01:30 +0000</pubDate>
		<dc:creator>Mathias Stjernström</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Sinatra]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[deploy]]></category>
		<category><![CDATA[passenger]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[webroot]]></category>

		<guid isPermaLink="false">http://www.pastbedti.me/?p=610</guid>
		<description><![CDATA[My Sinatra + Apache + Passenger setup did not just run Deploying a simple Sinatra rack application under Apache and Phusion Passenger turned out not work out of the box for me. I already had a virtual host so I decided to deploy with passengers sub URI (sub URI documentation). To make this work you&#8217;ll [...]]]></description>
			<content:encoded><![CDATA[<h3>My Sinatra + Apache + Passenger setup did not just run <img src='http://www.pastbedti.me/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </h3>
<p>Deploying a simple Sinatra rack application under Apache and Phusion Passenger turned out not work out of the box for me. </p>
<p>I already had a virtual host so I decided to deploy with passengers sub URI (<a href="http://www.modrails.com/documentation/Users%20guide.html#deploying_rack_to_sub_uri" target="_blank">sub URI documentation</a>).</p>
<p>To make this work you&#8217;ll need Apache installed with Phusion Passenger setup (<a href="http://www.modrails.com/install.html" target="_blank">Passenger installation</a>)</p>
<p>
<h3>This is what I started with</h3>
<p>This is my folders for the already existing website.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># Existing homedir</span><br />
<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>my_web<span style="color: #000000; font-weight: bold;">/</span><br />
<span style="color: #666666; font-style: italic;"># Current webroot</span><br />
<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>my_web<span style="color: #000000; font-weight: bold;">/</span>htdocs</div></td></tr></tbody></table></div>
<p>
<h3>Creating folders and files for Sinatra</h3>
<p>The first thing you want to do is to create folders and files for Sinatra.</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mkdir /home/my_web/sinatra</div></td></tr></tbody></table></div>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">cd /home/my_web/sinatra<br />
mkdir tmp<br />
mkdir logs<br />
mkdir public<br />
touch app.rb<br />
touch config.ru</div></td></tr></tbody></table></div>
<p>
<h3>Create symlink</h3>
<p>Create a symbolic link from our current webroot to the new Sinatra app so that apache/passenger can find it.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>my_web<span style="color: #000000; font-weight: bold;">/</span>sinatra<span style="color: #000000; font-weight: bold;">/</span>public <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>my_web<span style="color: #000000; font-weight: bold;">/</span>htdocs<span style="color: #000000; font-weight: bold;">/</span>app</div></td></tr></tbody></table></div>
<p>
<h3>Creating the application</h3>
<p>We also need a Sinatra application for this to work so lets fill those files.</p>
<p>
<h4>File: config.ru</h4>
<div class="codecolorer-container ruby twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br /></div></td><td><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'app'</span><br />
<br />
set <span style="color:#ff3333; font-weight:bold;">:environment</span>, ENV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'RACK_ENV'</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">to_sym</span><br />
set <span style="color:#ff3333; font-weight:bold;">:app_file</span>, &nbsp; &nbsp; <span style="color:#996600;">'app.rb'</span><br />
disable <span style="color:#ff3333; font-weight:bold;">:run</span><br />
<br />
log = <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;logs/sinatra.log&quot;</span>, <span style="color:#996600;">&quot;a&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
STDOUT.<span style="color:#9900CC;">reopen</span><span style="color:#006600; font-weight:bold;">&#40;</span>log<span style="color:#006600; font-weight:bold;">&#41;</span><br />
STDERR.<span style="color:#9900CC;">reopen</span><span style="color:#006600; font-weight:bold;">&#40;</span>log<span style="color:#006600; font-weight:bold;">&#41;</span><br />
<br />
run <span style="color:#6666ff; font-weight:bold;">Sinatra::Application</span></div></td></tr></tbody></table></div>
<p>
<h4>File: app.rb</h4>
<div class="codecolorer-container ruby twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br /></div></td><td><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rubygems'</span><br />
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'sinatra'</span><br />
<br />
before <span style="color:#9966CC; font-weight:bold;">do</span> <br />
&nbsp; <span style="color:#008000; font-style:italic;"># Strip the last / from the path</span><br />
&nbsp; request.<span style="color:#9900CC;">env</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'PATH_INFO'</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#CC0066; font-weight:bold;">gsub!</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">/</span>\<span style="color:#006600; font-weight:bold;">/</span>$<span style="color:#006600; font-weight:bold;">/</span>, <span style="color:#996600;">''</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span><br />
<br />
get <span style="color:#996600;">''</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; &nbsp;<span style="color:#996600;">&quot;Hello world&quot;</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span></div></td></tr></tbody></table></div>
<p>
<h3>Apache configuration</h3>
<p>Now we need to setup apache so that it can find our Sinatra app and load it.</p>
<p>The only thing you need to do is add the following line to your existing VirtualHost block:</p>
<div class="codecolorer-container apache twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="apache codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">RackBaseURI /app</div></td></tr></tbody></table></div>
<p>This line will tell passenger to look into our existing webroot for a symlink thats named app and which points to our rack app.  (<a href="http://www.modrails.com/documentation/Users%20guide.html#RackBaseURI" target="_blank">RackBaseURI  documentation</a>)</p>
<p>
<h3>Virtual host entry</h3>
<div class="codecolorer-container apache twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br /></div></td><td><div class="apache codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;<span style="color: #000000; font-weight:bold;">VirtualHost</span> *:<span style="color: #ff0000;">80</span>&gt;<br />
&nbsp; <span style="color: #00007f;">ServerName</span> www.example.com<br />
&nbsp; <span style="color: #00007f;">ServerAlias</span> example.com<br />
&nbsp; <span style="color: #00007f;">DocumentRoot</span> /home/my_web/htdocs/<br />
&nbsp; RackBaseURI /app<br />
<br />
&nbsp; &lt;<span style="color: #000000; font-weight:bold;">Directory</span> <span style="color: #7f007f;">&quot;/home/my_web/htdocs/&quot;</span>&gt;<br />
&nbsp; &nbsp; <span style="color: #00007f;">Order</span> <span style="color: #00007f;">allow</span>,<span style="color: #00007f;">deny</span><br />
&nbsp; &nbsp; <span style="color: #00007f;">Allow</span> from <span style="color: #0000ff;">all</span><br />
&nbsp; &nbsp; <span style="color: #00007f;">AllowOverride</span> <span style="color: #0000ff;">All</span><br />
&nbsp; &lt;/<span style="color: #000000; font-weight:bold;">Directory</span>&gt;<br />
&lt;/<span style="color: #000000; font-weight:bold;">VirtualHost</span>&gt;</div></td></tr></tbody></table></div>
<p>The best part is that you are allowed to specify this option multiple times. So you can easily setup multiple apps under the same virtual host.</p>
<p>Cheers! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.pastbedti.me/2009/11/deploying-a-sinatra-app-with-apache-and-phusion-passenger-a-k-a-mod_rack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gentoo/Linux freezing under VMware ESX/ESXi</title>
		<link>http://www.pastbedti.me/2008/11/gentoolinux-freezing-under-vmware-esxesxi/</link>
		<comments>http://www.pastbedti.me/2008/11/gentoolinux-freezing-under-vmware-esxesxi/#comments</comments>
		<pubDate>Wed, 05 Nov 2008 22:02:58 +0000</pubDate>
		<dc:creator>Mathias Stjernström</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Operatingsystem]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://www.pastbedti.me/?p=117</guid>
		<description><![CDATA[We recently got in trouble with two Gentoo machines that where running under VMware ESX &#38; ESXi. The hosts froze randomly (Even the console in vmware froze). Especially when putting a little load on the machines. After hours of testing we found that removing virtual CPU&#8217;s from the host solved the problem. More that one CPU got [...]]]></description>
			<content:encoded><![CDATA[<p>We recently got in trouble with two <a title="Gentoo" href="http://www.gentoo.org/">Gentoo</a> machines that where running under VMware ESX &amp; ESXi.</p>
<p>The hosts froze randomly (<em>Even the console in vmware froze</em>). Especially when putting a little load on the machines. After hours of testing we found that removing virtual CPU&#8217;s from the host solved the problem. More that one CPU got the machine to freeze after some time.</p>
<p><strong>!! Unsatisfied solution !!</strong> So after a couple of more hours we found a working solution&#8230;.</p>
<p><span id="more-117"></span></p>
<p>The solution was to disable the time stamp counter hardware in the host. This is done by passing <strong>notsc</strong> on the kernel command line. </p>
<p>We found people running <a title="Ubuntu" href="http://www.ubuntu.com/">Ubuntu </a>with a similar problem and some of them solved the problem with passing clocksource=acpi_pm on the kernel command line. The clocksource problem is known by VMware and more information can be found here <a href="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=1007020">http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=1007020</a>. This did however not solved our problem but some readers may find it helpful. </p>
<p>Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pastbedti.me/2008/11/gentoolinux-freezing-under-vmware-esxesxi/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Redirecting with nginx</title>
		<link>http://www.pastbedti.me/2008/05/redirecting-with-nginx/</link>
		<comments>http://www.pastbedti.me/2008/05/redirecting-with-nginx/#comments</comments>
		<pubDate>Wed, 21 May 2008 17:22:37 +0000</pubDate>
		<dc:creator>Mathias Stjernström</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://www.stjernstrom.se/?p=15</guid>
		<description><![CDATA[Today one of our server got in trouble with an ACE encoded IDN domain. The problem seemed to be rails in combination with nginx&#8217;s X-Sendfile feature. The result became that when accessing the site trough the IDN domain x-senfile did not send any files&#8230;. Our quick and dirty solution (until we have found the source/or solved the [...]]]></description>
			<content:encoded><![CDATA[<p>Today one of our server got in trouble with an ACE encoded <a href="http://en.wikipedia.org/wiki/Internationalized_domain_name" target="_blank">IDN</a> domain. The problem seemed to be rails in combination with <a href="http://wiki.codemongers.com/NginxXSendfile" target="_blank">nginx&#8217;s X-Sendfile</a> feature. The result became that when accessing the site trough the IDN domain x-senfile did not send any files&#8230;.</p>
<p>Our quick and dirty solution (<em>until we have found the source/or solved the problem</em>) became redirecting all traffic from the IDN domain to the domain without <a href="http://www.iana.org/domains/idn-tables/tables/se_sv-se_1.0.html" target="_blank">strange-swedish-characters</a>.</p>
<p>With nginx this is as simple as in most webservers just put the following code before you original server configuration in nginx.conf.</p>
<div class="codecolorer-container html4strict twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">server {<br />
&nbsp; &nbsp; server_name &nbsp;xn--svenskdomn-y5a.se www.xn--svenskdomn-y5a.se;<br />
&nbsp; &nbsp; rewrite ^(.*) http://www.svenskdoman.se$1 permanent;<br />
}</div></td></tr></tbody></table></div>
<p>And Bowang! All requests to www.svenskdomän.se will be redirected to www.svenskdoman.se.</p>
<p>Domain names have been changed to protect the innocent <img src='http://www.pastbedti.me/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pastbedti.me/2008/05/redirecting-with-nginx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

