<?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>Webmasterwords &#187; Hosting</title>
	<atom:link href="http://www.webmasterwords.com/category/hosting/feed" rel="self" type="application/rss+xml" />
	<link>http://www.webmasterwords.com</link>
	<description>Useful snippets for Webmasters</description>
	<lastBuildDate>Wed, 21 Sep 2011 15:55:22 +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>Reset Mysql Root Password Script</title>
		<link>http://www.webmasterwords.com/mysql-root-password-reset-script?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-root-password-reset-script</link>
		<comments>http://www.webmasterwords.com/mysql-root-password-reset-script#comments</comments>
		<pubDate>Fri, 23 Jan 2009 17:27:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Hosting]]></category>

		<guid isPermaLink="false">http://www.webmasterwords.com/mysql-root-password-reset-script</guid>
		<description><![CDATA[Lost (forgotten) your mysql root / admin password? Not to worry, it happens to the best of us.

This simple BASH password reset script will enable you to reset any mysql user password without knowing the current password

I would not recommend running it on a live production system as it requires shutting down the mysql server.

Heres the script:, it needs to be run as root.

# Kill any mysql processes currently running
echo]]></description>
			<content:encoded><![CDATA[<p>Lost (forgotten) your mysql root / admin password? Not to worry, it happens to the best of us.</p>
<p>This simple BASH password reset script will enable you to reset any mysql user password without knowing the current password</p>
<p>I would not recommend running it on a live production system as it requires shutting down the mysql server.</p>
<p>Heres the script:, it needs to be run as root.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Kill any mysql processes currently running</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'Shutting down any mysql processes...'</span>
<span style="color: #c20cb9; font-weight: bold;">killall</span> <span style="color: #660033;">-vw</span> mysqld
&nbsp;
<span style="color: #666666; font-style: italic;"># Start mysql without grant tables</span>
mysqld_safe <span style="color: #660033;">--skip-grant-tables</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt;res <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">&amp;</span>amp;
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'Resetting password...'</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#Sleep for 5 while the new mysql process loads (if get a connection error you might need to increase this.</span>
<span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">5</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#Update user with new password</span>
mysql mysql <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;UPDATE user SET Password=PASSWORD('$2') WHERE User='$1';FLUSH PRIVILEGES;&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'Cleaning up..'</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#Kill the insecure mysql process</span>
<span style="color: #c20cb9; font-weight: bold;">killall</span> <span style="color: #660033;">-v</span> mysqld</pre></div></div>

<p>First variable is the user you want to reset, second variable is the password.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sh</span> mysqlreset root newpassword</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.webmasterwords.com/mysql-root-password-reset-script/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Squid Proxy On Solaris</title>
		<link>http://www.webmasterwords.com/squid-proxy-on-solaris?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=squid-proxy-on-solaris</link>
		<comments>http://www.webmasterwords.com/squid-proxy-on-solaris#comments</comments>
		<pubDate>Thu, 23 Aug 2007 17:17:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Hosting]]></category>

		<guid isPermaLink="false">http://www.webmasterwords.com/squid-proxy-on-solaris</guid>
		<description><![CDATA[<p>As part of a project I required a proxy which would allow remote users to access serveral internal servers sitting behind our firewall from a single access point. The easiest way of accomplishing this is via a proxy. My first choice of proxy is squid which supports HTTP, HTTPS, FTP and protocols. Used in reverse proxy mode it also alows you to reduce the load on webservers serving dynamic content</p>]]></description>
			<content:encoded><![CDATA[<p>As part of a project I required a proxy which would allow remote users to access serveral internal servers sitting behind our firewall from a single access point. The easiest way of accomplishing this is via a proxy.  My first choice of proxy is squid which supports HTTP, HTTPS, FTP and protocols.  Used in reverse proxy mode it also alows you to reduce the load on webservers serving dynamic content which is an added bonus. I&#8217;m used to building most of my stuff on Redhat Enterprise severs so i found it a bit of a steep learning curve when handed a Solaris 8 SPARC server without even a basic C-complier. I thought i&#8217;d document my steps here as a reference for others.</p>
<p>Squid is built in C so without a C compiler i was faced with two options. Build GCC on the solaris box or find a pre-complied Solaris binary for squid. Well i&#8217;ve built GCC before an its not a whole heep of fun so I chickened out and went for a squid binary. Here are the steps required.</p>
<p>Goto www.sunfreeware.com</p>
<p>Pick the OS and Processor from the left hand menu and then find the squid binary.</p>
<p>Download the squid binary package to /opt/temp. Note solaris 8 didn&#8217;t have the excellent wget by default so you might need to push it on to the server via ftp.</p>
<p>Use gunzip to extract the package.<br />
<strong>gunzip -xf squidfilename.gz</strong></p>
<p>Add the package using pkgadd and follow the instructions.<br />
<strong>pkgadd squidfilename </strong></p>
<p>Squid is installed in <strong>/usr/local/squid </strong></p>
<p>In order to run squid you need to give make the logs directory writeable<br />
<strong>chmod 665 /usr/local/squid/log</strong></p>
<p>You&#8217;ll also need to create a cache dir<br />
<strong>mkdir /usr/local/squid/cache</strong></p>
<p>Make the directory writeable<strong><br />
chmod 665 /usr/local/squid/cache</strong></p>
<p>Know you need to create the cache filestructure. To do this run squid with the <strong>-z</strong> option<br />
<strong>./usr/local/squid/bin/squid -z</strong></p>
<p>You can alter the squid settings by editing /usr/local/squid/etc/squid.conf When you&#8217;re happy you can know run squid.<br />
<strong>./usr/local/squid/bin/squid</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.webmasterwords.com/squid-proxy-on-solaris/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Elastic Web Hosting and Amazon ec2</title>
		<link>http://www.webmasterwords.com/elastic-web-hosting?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=elastic-web-hosting</link>
		<comments>http://www.webmasterwords.com/elastic-web-hosting#comments</comments>
		<pubDate>Tue, 24 Apr 2007 11:33:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Hosting]]></category>

		<guid isPermaLink="false">http://www.webmasterwords.com/elastic-web-hosting</guid>
		<description><![CDATA[<strong>What is elastic webhosting?</strong>

Elastic web hosting in its simplest terms is a hosting account where resources can be rapidly expanded to meet demand. Still very much a new technology its use is gradually beginning to pick up as more and more people discover the limitations of fixed resource hosting. On a typical fixed hosting account you're allocated a fixed amount of resources and the amount you pay is based on]]></description>
			<content:encoded><![CDATA[<p><strong>What is elastic webhosting?</strong></p>
<p>Elastic web hosting in its simplest terms is a hosting account where resources can be rapidly expanded to meet demand. Still very much a new technology its use is gradually beginning to pick up as more and more people discover the limitations of fixed resource hosting. On a typical fixed hosting account you&#8217;re allocated a fixed amount of resources and the amount you pay is based on the size of those resources. This model means that in order to keep your site running smoothly you need to be able to accurately predict the maximum amount of load that the server will be subjected to. This can be a nightmare for small startup companies who may find it hard to judge how quickly their service will grow. With fixed resource hosting there are two options:</p>
<p>1. Buy a huge amount of resources initially so that should your website take off or receive unusually traffic spikes you won&#8217;t have to worry about migrating to a new server. This is a very costly solution and is often not viable for small startups.<br />
2. Buy a limited amount of resources initially and hope that you will have time to migrate the site to a new server should the website traffic increase. More cost effective but what happens if you your traffic increases rapidly over a number of days. The server gets swamped, there is no time to migrate and you&#8217;re facing downtime.<br />
But now there is a third option &#8211; Elastic hosting</p>
<p>With elastic hosting you can allocate additional resources in minutes should you server recieve an exceptional amount of traffic. Take for example Digg. Many smaller sites that get on the first page fall over because they do not have the resources to handle the huge amount of traffic that arrives over a period of 3-4 hours. In such a short space of time there is no chance of migrating the site to a new server and updating the name severs accordingly. This results in a loss of vistors and possibly missing out on potential revenue. Elastic hosting solves this. Not only can you allocate additional resources very quickly but more importantly it is often possible to automate the process. This is how it works.</p>
<p>1. A background process monitors resources on your server, it checks free memory, bandwidth, processing speed and disk space. More complex setups may also detect the rate of visitors to the site.</p>
<p>2. A sudden spike of traffic to the site causes the available memory to drop below a suitable level. The background process detects this drop and spawns another identical server and manages traffic with a load balancer.</p>
<p>3. The spike of traffic dies and the free memory on the server rises to an acceptable level. The background process recognizes this and terminates the additional resource.</p>
<p>You only pay for the amount of resources used. So instead of paying for a large amount of resources all the time you only pay for the additional resources when they are required.</p>
<p><strong>Elastic Hosting Providers</strong></p>
<p>Currently the most advanced elastic hosting package appears to be from Amazon in the form of their Amazon EC2 (elastic computing cloud) service. This service works in conjunction with their S3 image hosting service and data transfer between the services is completely free. Which means your bandwidth costs will be considerably lower than on a standard webhost. The only bandwidth you pay for is for data transfered outside of the amazon network. I&#8217;m currently testing this service out and will report back with my findings within a month or two.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webmasterwords.com/elastic-web-hosting/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ruby Rails Mongrel Apache Easy</title>
		<link>http://www.webmasterwords.com/ruby-rails-mongrel-apache-easy?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=ruby-rails-mongrel-apache-easy</link>
		<comments>http://www.webmasterwords.com/ruby-rails-mongrel-apache-easy#comments</comments>
		<pubDate>Tue, 31 Oct 2006 17:24:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.webmasterwords.com/ruby-rails-mongrel-apache-easy</guid>
		<description><![CDATA[<p>Having attempted to set ruby on rails up many times, this is by far my favourite soloution and it also happens to be the simplest. Why did i go the mongrel route? Well because FastCgi with Apache make me want to cry. Its buggy (especially on fedora and CentOS) and its a pain in the ass to setup. Where as mongrel on the other hand is a piece of cake.</p>]]></description>
			<content:encoded><![CDATA[<p>Having attempted to set ruby on rails up many times, this is by far my favourite soloution and it also happens to be the simplest. Why did i go the mongrel route? Well because FastCgi with Apache make me want to cry. Its buggy (especially on fedora and CentOS) and its a pain in the ass to setup. Where as mongrel on the other hand is a piece of cake.</p>
<p>In theory you could run mongrel, bind it to port 80 and do away with apache all together. There are a few reasons why i don&#8217;t wanna do this:</p>
<p>1. I like apache, although its a bit of a resource hog its a solid and secure webserver, has tons of great features and a large community behind it.</p>
<p>2. The other stuff I&#8217;ll be running on the server is made up of static pages and other CGI scripts for which I still believe apache is the best option.</p>
<p>In order to serve a rails application on the default port 80 we will use apaches mod_proxy to forward requests to the mongrel server sitting onÂ  custom ports. To improve the performance its best to run more than once instance of the mongrel server and make use of apaches mod_proxy_balancer.</p>
<p>In order for this to work you&#8217;ll require a server running apache 2.2 and yum (or apt-get if your running a debian flavour).</p>
<p><strong>Installing ruby</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> ruby ruby-devel
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>rubyforge.org<span style="color: #000000; font-weight: bold;">/</span>frs<span style="color: #000000; font-weight: bold;">/</span>download.php<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">11289</span><span style="color: #000000; font-weight: bold;">/</span>rubygems-0.9.0.tgz
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xzf</span> rubygems-0.9.0.tgz
<span style="color: #7a0874; font-weight: bold;">cd</span> rubygems-0.9.0
ruby setup.rb</pre></div></div>

<p><strong>Installing mongrel</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gem <span style="color: #c20cb9; font-weight: bold;">install</span> mongrel</pre></div></div>

<p><strong>Building a test rails application</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>rails
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>rails
rails mytest</pre></div></div>

<p><strong>Starting mongrel</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">adduser mongrel
<span style="color: #7a0874; font-weight: bold;">cd</span> mytest
<span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> :mongrel <span style="color: #000000; font-weight: bold;">*</span>
<span style="color: #c20cb9; font-weight: bold;">su</span> mongrel
mongrel_rails start <span style="color: #660033;">-d</span> <span style="color: #660033;">-p</span> <span style="color: #000000;">3001</span> <span style="color: #660033;">-P</span> log<span style="color: #000000; font-weight: bold;">/</span>mongrel1.pid
mongrel_rails start <span style="color: #660033;">-d</span> <span style="color: #660033;">-p</span> <span style="color: #000000;">3002</span> <span style="color: #660033;">-P</span> log<span style="color: #000000; font-weight: bold;">/</span>mongrel2.pid
mongrel_rails start <span style="color: #660033;">-d</span> <span style="color: #660033;">-p</span> <span style="color: #000000;">3003</span> <span style="color: #660033;">-P</span> log<span style="color: #000000; font-weight: bold;">/</span>mongrel3.pid</pre></div></div>

<p>Make sure you start mongrel in the root directory of your rails project. If successful we now have three mongrel instances. To verify type ps -aux | grep mongrel</p>
<p><strong>Configuring Apache</strong></p>
<p>You&#8217;ll need to add the following code to your httpd.conf file</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">#define mongrel cluster
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;proxy</span> balancer://mongrelcluster<span style="color: #000000; font-weight: bold;">&gt;</span></span>
  BalancerMember http://127.0.0.1:3001
  BalancerMember http://127.0.0.1:3002
  BalancerMember http://127.0.0.1:3003
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/proxy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
#forward requests to mongrel cluster
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;virtualhost</span> *:80<span style="color: #000000; font-weight: bold;">&gt;</span></span>
  ServerName yourdomain.com
  ServerAlias www.yourdomain.com
  ProxyPass / balancer://mongrelcluster/
  ProxyPassReverse / balancer://mongrelcluster/
  ProxyPreserveHost on
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/virtualhost<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Finally navigate to yourdomain.com and you should see the &#8216;Welcome Aboard&#8217; default rails page.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webmasterwords.com/ruby-rails-mongrel-apache-easy/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

