<?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>Havoc Inspired &#187; Hosting</title>
	<atom:link href="http://www.havocinspired.co.uk/category/hosting/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.havocinspired.co.uk</link>
	<description>Home of Ryan Taylor</description>
	<lastBuildDate>Tue, 25 May 2010 21:20:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Edit your hosts file to test your website before it goes live</title>
		<link>http://www.havocinspired.co.uk/tutorial/edit-your-hosts-file-to-test-your-website-before-it-goes-live/</link>
		<comments>http://www.havocinspired.co.uk/tutorial/edit-your-hosts-file-to-test-your-website-before-it-goes-live/#comments</comments>
		<pubDate>Sat, 16 Jan 2010 21:43:13 +0000</pubDate>
		<dc:creator>Ryan Taylor</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.havocinspired.co.uk/?p=958</guid>
		<description><![CDATA[This is a little trick I've picked up that helped me out quite a bit, especially when developing Wordpress sites where you need to get the paths and URLs right for everything to work properly.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.havocinspired.co.uk%2Ftutorial%2Fedit-your-hosts-file-to-test-your-website-before-it-goes-live%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.havocinspired.co.uk%2Ftutorial%2Fedit-your-hosts-file-to-test-your-website-before-it-goes-live%2F&amp;source=ryanhavoc&amp;style=normal&amp;service=TinyURL.com" height="61" width="50" /><br />
			</a>
		</div>
<p>This is a little trick I&#8217;ve picked up that helped me out quite a bit, especially when developing Wordpress sites where you need to get the paths and URLs right for everything to work properly.</p>
<h3>The scenario</h3>
<blockquote><p>You’re hired to do the redesign of an existing website (example.com). Your client wants to move their website to your hosting (or new hosting) when the redesign goes live. You’ve agreed on a seamless transition from old to new on one sunny Monday morning in a months time.</p>
<p>So you get to work on the site in your chosen development area, demo it to the client, they’re happy and you transfer the site to the newly configured hosting space on your server, however the name servers for example.com haven’t been changed yet, it’s only Friday and the redesign isn’t going live until Monday, but you’re a contentious developer and you want to test the new design to ensure everything is working as expected in the live environment.</p>
<p>What do you do?</p></blockquote>
<h3>Our goal</h3>
<p>We’re going to edit the hosts file on our Mac to make our servers IP address (e.g. 70.26.55.80) resolve to example.com, just like what a DNS server does when example.com&#8217;s name servers have been changed to point to the new hosting.</p>
<h3>Configuring the server</h3>
<p>All server configurations are different but the principle is generally the same, we need to find out/set our example.com to appear in the web browser when we visit our example IP of 70.26.55.80. For this example I’m going to explain the process on a Plesk driven server (from this you should be able to get an idea of how this would be achieved through other management software packages).</p>
<ul>
<li>Configure your web space for example.com and upload all your files to it</li>
<li>Login to Plesk</li>
<li>Select <strong>Server</strong> from the left-hand menu</li>
<li>Go to the <strong>IP Addresses</strong> – This should present you with a list of IP addresses assigned to your server,  when you configured the hosting for example.com you will have selected one of these IP addresses (you may even only have one IP address in this list)</li>
<li>For each IP address there’s a column titled <strong>Hosting</strong> with a link showing the number of domains assigned to that IP address, click the link that corresponds with the IP address you selected for the web space</li>
<li>Select <strong>example.com</strong> and click<strong> Set As Default </strong>- You can only select one default domain to be displayed if you visit that IP address in a browser</li>
<li>Make a note of the IP address (e.g. 70.26.55.80)</li>
<li>Visit 70.26.55.80 in a web browser – You should be presented with your newly uploaded site for example.com</li>
</ul>
<h3>Editing the hosts file</h3>
<p>Mac’s have a hosts file that we can edit to make 70.26.55.80 resolve to example.com just as if the name servers for example.com had already been changed (obviously this only effects the Mac you are on).</p>
<p>I’m sure you’ll be able to do this on a PC as well but don’t ask me how, I’m a Mac man.</p>
<ul>
<li>Open a <strong>Terminal</strong></li>
<li>Enter <code>sudo vim /etc/hosts</code> then enter your administrator password</li>
</ul>
<p>This will open the hosts file in the vim editor. You should see something like this:</p>
<pre class="brush: plain;">
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0     localhost
</pre>
<p>To edit the file press ‘<strong>a</strong>’, cursor down to the bottom of the list and enter:</p>
<pre class="brush: plain;">
70.26.55.80       example.com
</pre>
<p>Press ‘<strong>esc</strong>’ then enter ‘<strong>:wp</strong>’ to write and quit vim.</p>
<p>If you now visit example.com in your web browser it should resolve to 70.26.55.80 (the new hosting) and you can test your newly designed site in its live environment.</p>
<p>Now all that has to be done to make the site seamless go live on Monday is change the name servers for example.com to point to your hosting and you can guarantee that everything will work.</p>
<p><em>Important note: Remember to take the entry for example.com out of your hosts file when you have finished testing, otherwise you may end up seeing a false representation of what is actually being displayed at that domain when the name servers are changed!</em></p>
<p>Final Tip: Instead of removing the line completely from your hosts file simply add a # to the beginning of the line. This &#8220;comments out&#8221; the line and stops it from being applied. If this is a process that you are going to use regularly in the future then the line is already in your hosts file and you can simply remove the # and change the domain name when you need to.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.havocinspired.co.uk/tutorial/edit-your-hosts-file-to-test-your-website-before-it-goes-live/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Plesk, PEAR, include_paths, open_basedir and Media Temple</title>
		<link>http://www.havocinspired.co.uk/tutorial/plesk-pear-include_paths-open_basedir-and-media-temple/</link>
		<comments>http://www.havocinspired.co.uk/tutorial/plesk-pear-include_paths-open_basedir-and-media-temple/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 23:52:04 +0000</pubDate>
		<dc:creator>Ryan Taylor</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Media Temple]]></category>
		<category><![CDATA[PEAR]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.havocinspired.co.uk/?p=740</guid>
		<description><![CDATA[In this tutorial I'll talk you through enabling PEAR packages on a server running the Plesk control panel.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.havocinspired.co.uk%2Ftutorial%2Fplesk-pear-include_paths-open_basedir-and-media-temple%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.havocinspired.co.uk%2Ftutorial%2Fplesk-pear-include_paths-open_basedir-and-media-temple%2F&amp;source=ryanhavoc&amp;style=normal&amp;service=TinyURL.com" height="61" width="50" /><br />
			</a>
		</div>
<p>If you <a href="http://www.havocinspired.co.uk/freelance/so-i-got-hacked/">follow my blog</a> you’ll know that I’ve recently moved to <a href="http://www.mediatemple.net">Media Temple</a> as my hosting provider. I’ve gone for a <a href="http://mediatemple.net/webhosting/dv/">Dedicated Virtual</a> server and so far I’m very pleased with the flexibility I have with it.</p>
<p>Media Temples’ servers, like many other providers, run <a href="http://www.parallels.com/uk/products/plesk/">Plesk</a> as their control panel which means there are a few quirks that need to be overcome.</p>
<p>I should say at this point that I don’t claim to be a Linux/Plesk expert, i simple know enough to find my way around (or enough to be dangerous depending on who you’re asking).</p>
<h3>Default behaviour</h3>
<p>By default Plesk uses the <a href="http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.open-basedir">PHP open_basedir</a> directive to limit access to files outside a sites directory-tree. So if you have setup the domain example.com all your files go into the httpdocs folder (unless you’re using an SSL certificate in which case they go in the httpsdocs folder). For our example.com domain the server path would be:</p>
<pre class="brush: bash;">/var/www/vhosts/example.com/httpdocs</pre>
<p>Plesk’s default value for open_basedir is:</p>
<pre class="brush: bash;">/var/www/vhosts/example.com</pre>
<p>Which means any PHP script you place in the httpdocs cannot dig any further down the directory-tree than the example.com folder.</p>
<p>This is a security measure.</p>
<h3>The problem</h3>
<p>There are two scenarios (that I’ve come across) where this is a problem. The first is if you want to use <a href="http://pear.php.net/">PEAR</a>, which is the scenario I’m most common with and will be covering the solution for here, and the second is if you want to use the Expression Engine Multi Site Manager.</p>
<p>Both require PHP scripts to access files outside of their directory-tree.</p>
<h3>The solution</h3>
<p>To enable access to PEAR packages we need to add the server path to the open_basedir variable as well as the include_path variable. If you’re on a Media Temple server like me the path should be:</p>
<pre class="brush: bash;">/usr/share/pear</pre>
<p>If not you’ll need to locate the folder that PEAR is installed in on your server.</p>
<h4>Step 1 &#8211; SSH to the server</h4>
<p>You need to SSH into your server, if you are with Media Temple and this is the first time you are trying to do this, you’ll first need to enable Root Access for your domain through your <a href="https://ac.mediatemple.net/">Media Temple Account Center</a>.</p>
<p>If you’re on a Mac you can use Terminal to SSH to your server with:</p>
<pre class="brush: bash;">ssh admin@example.com</pre>
<p>Then your passworld.</p>
<p>If you’re on a PC you can use <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/">Putty</a>. My memory is fuzzy on the exact use however, so you’ll need to consult the manual.</p>
<p>Once you are connected to your server you will need to switch user to root for the next step. To do this enter:</p>
<pre class="brush: bash;">su - root</pre>
<p>Then your password.</p>
<h4>Step 2 &#8211; Create a vhost.conf file</h4>
<p>Be careful, you now have godly control of your server!</p>
<p>We now need to create a vhost.conf file for our example.com domain which will override Plesk’s default settings.</p>
<p>The following command will create the file:</p>
<pre class="brush: bash;">vim /var/www/vhosts/example.com/conf/vhost.conf</pre>
<p>If you’ve never used vim (which is an editor for Linux) you need to know that pressing the &#8216;<strong>a</strong>&#8216; key puts you into author mode and the &#8216;<strong>esc</strong>&#8216; key takes you out (this is about the extent of my vim knowledge, I hope you are impressed!).</p>
<p>While in author mode enter the following information:</p>
<pre class="brush: bash;">
&lt;Directory &quot;/home/httpd/vhosts/example.com/httpdocs&quot;&gt;
php_admin_value open_basedir &quot;/home/httpd/vhosts/example.com/httpdocs:/usr/share/pear:/tmp&quot;
php_admin_value safe_mode Off
php_admin_value include_path &quot;.:/usr/share/pear&quot;
&lt;/Directory&gt;
</pre>
<p>To save the file and quit, press the &#8216;<strong>esc</strong>&#8216; key to leave author mode and type &#8216;<strong>:wq</strong>&#8216; (write and quit) and press enter.</p>
<p>So you can see that we specify the location of our example.com domain, added /usr/share/pear to the open_basedire variable and turned off safe_mode&#8230;?</p>
<p>PHP documentation states that open_basedir isn’t effected by safe_mode being on or off however from my experience if you don’t have it turned off, PEAR doesn’t work, as I say I’m no expert so maybe someone can enlighten me?</p>
<p>You can also see that we set the PHP include_path to also include /usr/share/pear</p>
<h4>A little gotcha</h4>
<p>We use php_admin_value to set the include_path. This means that the include path cannot be change using the PHP <a href="http://php.net/manual/en/function.set-include-path.php">set_include_path</a> function.</p>
<p>If you want to be able to change the include_path from within your script, perhaps you want to include a folder containing your own classes for example, you need to change:</p>
<pre class="brush: bash;">php_admin_value include_path &quot;.:/usr/share/pear&quot;</pre>
<p>To:</p>
<pre class="brush: bash;">php_value include_path &quot;.:/usr/share/pear&quot;</pre>
<h3>Step 3 &#8211; The scary bit! Reconfigure and restart apache</h3>
<p>You now need to run the following command so that the server knows to use our new vhost.conf file:</p>
<pre class="brush: bash;">/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=example.com</pre>
<p>And then restart apache:</p>
<pre class="brush: bash;">
/etc/init.d/httpd stop
/etc/init.d/httpd start
</pre>
<h3>Conclusion</h3>
<p>That should be it, you’re all PEAR’ed up and ready to go. You should note that this configuration will only effect the example.com domain. If you create a new domain you&#8217;ll have to create a vhost.conf file for that domain as well. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.havocinspired.co.uk/tutorial/plesk-pear-include_paths-open_basedir-and-media-temple/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>So I got hacked!</title>
		<link>http://www.havocinspired.co.uk/freelance/so-i-got-hacked/</link>
		<comments>http://www.havocinspired.co.uk/freelance/so-i-got-hacked/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 11:42:18 +0000</pubDate>
		<dc:creator>Ryan Taylor</dc:creator>
				<category><![CDATA[Freelance]]></category>
		<category><![CDATA[Hosting]]></category>

		<guid isPermaLink="false">http://www.havocinspired.co.uk/?p=604</guid>
		<description><![CDATA[Around 3pm on Sunday 4th October, Havoc Inspired and all my client sites along with about 700 other sites hosted on the same server, were hacked!]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.havocinspired.co.uk%2Ffreelance%2Fso-i-got-hacked%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.havocinspired.co.uk%2Ffreelance%2Fso-i-got-hacked%2F&amp;source=ryanhavoc&amp;style=normal&amp;service=TinyURL.com" height="61" width="50" /><br />
			</a>
		</div>
<p>Around 3pm on Sunday 4th October, Havoc Inspired and all my client sites along with about 700 other sites hosted on the same server, were hacked!</p>
<p>24 hours later I received an e-mail from my hosting provider:</p>
<blockquote><p>
At approximately 14:48 on Sunday all accounts on the server we host your reseller account on were targeted by a hacking group. They exploited a script from a customers account and were able to upload malicious scripts which were then used to exploit a PHP function to deface all hosting accounts on this server.</p>
<p>As soon as the hack was discovered we began restoring all accounts using our R1Soft CDP Backup system, this process however is taking much longer than normal and we will be raising this with R1Soft which we understand this doesn’t help you now. The full restore process should be complete within the next couple of hours, at this moment most sites on the server are back to normal.
</p></blockquote>
<p>Several of my client sites are still yet to be restored&#8230;</p>
<p>The attackers basically replaced every index file on the server with their own malicious script that shrank the browser window and made it float around the screen, eventually resulting in the browser crashing.</p>
<p>As you can imagine, I find this unacceptable. Therefore I have decided to move to a dedicated virtual server with <a href="http://www.mediatemple.net">Media Temple</a>. I have had mixed responses to this decision, some people worn against, others swear by them&#8230; </p>
<p>The server runs Plesk which I am pretty familiar with already and was available for me to start configuring within 15 minutes of me pleasing the order, very impressive!</p>
<p>Their knowledge base also seems to be quite extensive and I&#8217;ve easily found example commands that I just needed refreshing on.</p>
<p>So so far so good. I kind of feel like a grown up now, having my own server and there&#8217;s something about being able to SSH that just feels hardcore to me. </p>
<p>Anyone else with Media Temple? Experiences good or bad? </p>
]]></content:encoded>
			<wfw:commentRss>http://www.havocinspired.co.uk/freelance/so-i-got-hacked/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
