<?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>FettesPS &#187; Server</title>
	<atom:link href="http://www.fettesps.com/category/linux/server-linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.fettesps.com</link>
	<description>Fettes Programming Solutions</description>
	<lastBuildDate>Sun, 22 Jan 2012 18:21:51 +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>Installing Archey on Ubuntu</title>
		<link>http://www.fettesps.com/installing-archey-on-ubuntu/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=installing-archey-on-ubuntu</link>
		<comments>http://www.fettesps.com/installing-archey-on-ubuntu/#comments</comments>
		<pubDate>Wed, 02 Feb 2011 12:58:43 +0000</pubDate>
		<dc:creator>FettesPS</dc:creator>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[archey]]></category>
		<category><![CDATA[linux mint]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.fettesps.com/?p=1022</guid>
		<description><![CDATA[Ever since the first time I saw Arch Linux in action I&#8217;ve been in love with Archey.  For those of you who don&#8217;t know, Archey is just a little script that gets your current system information and displays it in the terminal with some ascii art. My initial search for Archey on the Debian platform [...]]]></description>
			<content:encoded><![CDATA[<p>Ever since the first time I saw Arch Linux in action I&#8217;ve been in love with Archey.  For those of you who don&#8217;t know, Archey is just a little script that gets your current system information and displays it in the terminal with some ascii art.  My initial search for Archey on the Debian platform</p>
<pre class="brush: plain; title: ; notranslate">
sudo apt-get install lsb-release scrot
wget http://github.com/downloads/djmelik/archey/archey-0.2.8.deb
sudo dpkg -i archey-0.2.8.deb
</pre>
<p>If you&#8217;re running Crunchbang, which at the time of writing this article is using Ubuntu 9.04 as it&#8217;s base, you&#8217;ll need to get a more up-to-date version of coreutils or else Archey will give you the following error:</p>
<pre class="brush: plain; title: ; notranslate">
user@crunchbang:/usr/bin$ archey
df: unrecognised option '--total'
Try `df --help' for more information.
Traceback (most recent call last):
  File &quot;/usr/bin/archey&quot;, line 304, in &lt;module&gt;
    func()
  File &quot;/usr/bin/archey&quot;, line 285, in disk_display
    total = p1.splitlines()[-1]
IndexError: list index out of range
</pre>
<p>Naturally, I&#8217;d assume that anyone running a version of Ubuntu that&#8217;s 9.04 or older will encounter the same issue.  I did not run into it on my Linux Mint 8 box or my Ubuntu 10.10 box.  By typing <i>df &#8211;version</i> you&#8217;ll see that it only has 6.10 included. You&#8217;ll want at least version 7 or else your <i>df</i> command will not support the <i>&#8211;total</i> flag.  So go ahead and download the package and install it:</p>
<pre class="brush: plain; title: ; notranslate">
wget http://ftp.us.debian.org/debian/pool/main/c/coreutils/coreutils_8.5-1_i386.deb
sudo dpkg -i coreutils_8.5-1_i386.deb
</pre>
<p>Now when you run Archey it should run as expected, without any errors.  Your next step is then to add it to your .bashrc so that it executes each time you open a terminal.  Open it up with your favourite text editor and add <b>archey</b> to the end of it an dhten save it.  Now every time you open a terminal or SSH into your box you should be presented with something like this:</p>
<pre class="brush: bash; title: ; notranslate">
                          .oyhhs:   User: fettesps
                 ..--.., shhhhhh-   Hostname: fettesps-crunchbang
               -+++++++++`:yyhhyo`  OS: Ubuntu 9.04 i686
          .--  -++++++++/-.-::-`    Kernel: 2.6.28-13-generic
        .::::-   :-----:/+++/++/.   Uptime: 2 days, 4:44
       -:::::-.          .:++++++:  Window Manager: Openbox
  ,,, .:::::-`             .++++++- Shell: Bash
./+++/-`-::-                ./////: Terminal: Xterm
+++++++ .::-                        Packages: 1036
./+++/-`-::-                :yyyyyo CPU: Pentium(R) Dual-Core CPU E6300 @ 2.80GHz
  ``` `-::::-`             :yhhhhh: RAM: 266 MB / 497 MB
       -:::::-.         `-ohhhhhh+  Disk: 2.2G / 49G
        .::::-` -o+///+oyhhyyyhy:
         `.--  /yhhhhhhhy+,....
               /hhhhhhhhh-.-:::;
               `.:://::- -:::::;
                         `.-:-'
</pre>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fettesps.com/installing-archey-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wildcard Subdomain Hosting on Linux</title>
		<link>http://www.fettesps.com/wildcard-subdomain-hosting-on-linux/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wildcard-subdomain-hosting-on-linux</link>
		<comments>http://www.fettesps.com/wildcard-subdomain-hosting-on-linux/#comments</comments>
		<pubDate>Sat, 31 Oct 2009 04:29:11 +0000</pubDate>
		<dc:creator>FettesPS</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[bind]]></category>
		<category><![CDATA[cname]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[subdomain]]></category>

		<guid isPermaLink="false">http://www.fettesps.com/?p=692</guid>
		<description><![CDATA[I recently had to set up wildcard hosting on one of my Ubuntu servers. Previously I had only done this on FreeBSD so I had to do a bit of research to find out what the best method would be. It turns out the solution is quite simple and elegant. Now why would you need [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had to set up wildcard hosting on one of my Ubuntu servers.  Previously I had only done this on FreeBSD so I had to do a bit of research to find out what the best method would be.  It turns out the solution is quite simple and elegant.  </p>
<p>Now why would you need a setup like this?  Well there are many reasons, perhaps you&#8217;ve set up your own free webhosting company where each account gets their own subdomain, or you need to set up a large number of subdomains for your new website but you just can&#8217;t be bothered to enter them all by hand.  </p>
<p>I will assume you already have your standard LAMP setup, with Bind9 installed.  Your first job will be to set up an A record for your wildcard domain. Open up your zone file with your favourite editor, and add the following to the bottom:</p>
<pre class="brush: plain; title: ; notranslate">*.yourdomain.com.    IN      A       192.168.0.1</pre>
<p>Naturally you&#8217;ll be replacing both the domain name and IP with ones that are appropriate to your configuration.  Also, make sure you specify any other subdomains that you don&#8217;t want to handled by the wildcard.  Your final zone record should look something like the following:</p>
<pre class="brush: plain; title: ; notranslate">yourdomain.com. 86400
    IN      SOA     yourdomain.com. hostmaster.yourdomain.com. (
        2009103004
        10800
        3600
        3600000
        86400 )
    IN      NS      ns1.yourdomain.com.
    IN      NS      ns2.yourdomain.com.
    IN      MX      10      mail.yourdomain.com.
    IN      A       192.168.0.1
mail                    IN      A       192.168.0.1
ns1                     IN      A       192.168.0.1
ns2                     IN      A       192.168.1.1
*.example.com.		IN      A       192.168.0.1</pre>
<p>Great, now that we have our zone configured we need to enable it by reloading bind9:</p>
<pre class="brush: plain; title: ; notranslate">sudo /etc/init.d/bind9 reload</pre>
<p>Next on the list is configuring your virtual host to handle all of these subdomains.  There are many ways you can do this, depending on the result you want.  You may want one virtual host for your primary subdomain (www) and one for all your subdomains, or you may want to combine them all into one and handle the subdomains with mod_rewrite.  For the purpose of this demonstration I will assume the later.</p>
<p>Open up your existing virtual host definition file or create a new one if needed.  These are stored in /etc/apache2/sites-available/ and are usually named the same as the domain.  You&#8217;re going to be adding a ServerAlias definition, and your file should end up looking something like this: </p>
<pre class="brush: plain; title: ; notranslate">&lt;VirtualHost *&gt;
    ServerName  yourdomain.com
    ServerAlias *.yourdomain.com
    DocumentRoot /home/yourdomain.com/www
    ....
&lt;/VirtualHost&gt;</pre>
<p>I&#8217;ve slimmed down this example, your virtual host file may have other declarations in it.  Once you&#8217;ve finished editing this file, enable it if you haven&#8217;t done so already.  This involves creating a symlink of the configuration file in /etc/apache2/sites-enabled, which can be done very easily by the use of the a2ensite command which is available only in Debian based distributions.  After adding the new site, reload Apache.</p>
<pre class="brush: plain; title: ; notranslate">sudo a2ensite yourdomain.com
sudo /etc/init.d/apache reload</pre>
<p>So now you&#8217;ve set up your DNS to accept connections on any subdomain, and Apache is set up to direct these connections to a specific folder on your system.  Where do we go from here?  Once again, that depends on what your trying to accomplish, but I&#8217;ll give you a few suggestions.</p>
<p>The simplest way is to setup your index file to check what the subdomain is and generate the output based on that. An example would be switching the database depending on which subdomain is used:</p>
<pre class="brush: plain; title: ; notranslate"># Determine Subdomain
$domain = $_SERVER['HTTP_HOST'];
$domain_parts = explode(&quot;.&quot;, $domain);
$subdomain = $domain_parts[0];

# Select Required Database
mysql_connect(&quot;localhost&quot;, &quot;root&quot;, &quot;password&quot;);
mysql_select_db($subdomain);
</pre>
<p>Or if you have mod_rewrite enabled you can modify your .htaccess file and redirect any subdomain&#8217;s traffic to a matching folder name in the DocumentRoot:</p>
<pre class="brush: plain; title: ; notranslate">RewriteEngine on
RewriteCond %{http_host} .
RewriteCond %{http_host} !^www.yourdomain.com [NC]
RewriteCond %{http_host} ^([^.]+)\.yourdomain.com [NC]
RewriteRule ^(.*) http://www.yourdomain.com/%1/ [R=301,L,QSA] </pre>
<p>So if a visitor came to the URL http://example.yourdomain.com they would then be redirected to http://www.yourdomain.com/example/. Beyond that, I&#8217;ll let you use your own imagination.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fettesps.com/wildcard-subdomain-hosting-on-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

