<?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>david winter &#187; apache</title>
	<atom:link href="http://davidwinter.me.uk/articles/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://davidwinter.me.uk</link>
	<description>you were expecting someone else?</description>
	<lastBuildDate>Mon, 28 Jun 2010 20:37:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Avoid giving 777 permissions</title>
		<link>http://davidwinter.me.uk/articles/2010/06/28/avoid-giving-777-permissions/</link>
		<comments>http://davidwinter.me.uk/articles/2010/06/28/avoid-giving-777-permissions/#comments</comments>
		<pubDate>Mon, 28 Jun 2010 20:37:42 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://davidwinter.me.uk/?p=211</guid>
		<description><![CDATA[Just a quick post for me to remember the following workflow of commands: sudo find . -type d -exec chmod 755 {} \; sudo find . -type f -exec chmod 644 {} \; sudo chgrp -R www-data . sudo chmod -R g+w .]]></description>
			<content:encoded><![CDATA[<p>Just a quick post for me to remember the following workflow of commands:</p>

<pre><code>sudo find . -type d -exec chmod 755 {} \;
sudo find . -type f -exec chmod 644 {} \;
sudo chgrp -R www-data .
sudo chmod -R g+w .
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://davidwinter.me.uk/articles/2010/06/28/avoid-giving-777-permissions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Redirecting Apache traffic to a maintenance page</title>
		<link>http://davidwinter.me.uk/articles/2010/05/03/redirecting-apache-traffic-to-a-maintenance-page/</link>
		<comments>http://davidwinter.me.uk/articles/2010/05/03/redirecting-apache-traffic-to-a-maintenance-page/#comments</comments>
		<pubDate>Mon, 03 May 2010 18:54:21 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://davidwinter.me.uk/?p=173</guid>
		<description><![CDATA[Here&#8217;s a simple solution to redirect users to a maintenance page in Apache. This rewrite rule can stay in your config (&#60;VirtualHost&#62; or .htaccess) all the time; all that you need to enable it is to create the file maintenance.html. The first rewrite condition checks to see if the file exists, and only if it [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a simple solution to redirect users to a maintenance page in Apache. This rewrite rule can stay in your config (<code>&lt;VirtualHost&gt;</code> or <code>.htaccess</code>) all the time; all that you need to enable it is to create the file <code>maintenance.html</code>.</p>

<p>The first rewrite condition checks to see if the file exists, and only if it does, will it redirect all traffic to it. The second rewrite condition is there to prevent an infinite loop, by  only redirecting traffic to files other than <code>maintenance.html</code>.</p>

<pre><code>RewriteEngine On

RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f
RewriteCond %{REQUEST_FILENAME} !/maintenance.html
RewriteRule ^.*$    /maintenance.html [L]
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://davidwinter.me.uk/articles/2010/05/03/redirecting-apache-traffic-to-a-maintenance-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache, PHP and MongoDB on Mac OS X 10.6 Snow Leopard</title>
		<link>http://davidwinter.me.uk/articles/2010/01/02/apache-php-and-mongodb-on-mac-os-x-10-6-snow-leopard/</link>
		<comments>http://davidwinter.me.uk/articles/2010/01/02/apache-php-and-mongodb-on-mac-os-x-10-6-snow-leopard/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 13:12:13 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[macports]]></category>
		<category><![CDATA[mongodb]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://davidwinter.me.uk/?p=152</guid>
		<description><![CDATA[MongoDB (from &#8220;humongous&#8221;) is a scalable, high-performance, open source, schema-free, document-oriented database. There&#8217;s a lot of buzz brewing about it, so I wanted to give it a try with PHP on my development Mac. The following is how I went about installing Apache, PHP and MongoDB on Snow Leopard. You must have installed the Xcode [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.mongodb.org/display/DOCS/Home">MongoDB</a> (from &#8220;humongous&#8221;) is a scalable, high-performance, open source, schema-free, document-oriented database.</p>

<p>There&#8217;s a lot of <a href="http://delicious.com/search?p=mongodb&amp;chk=&amp;context=popular|&amp;fr=del_icio_us&amp;lc=">buzz</a> brewing about it, so I wanted to give it a try with PHP on my development Mac. The following is how I went about installing Apache, PHP and MongoDB on Snow Leopard. You must have installed the <a href="[http://developer.apple.com/tools/xcode/">Xcode</a> developer tools (found on the Snow Leopard install DVD) and <a href="[http://www.macports.org/">MacPorts</a> for this to all work.</p>

<p><span id="more-152"></span></p>

<p>First, let&#8217;s install Apache:</p>

<pre><code>sudo port install apache2
</code></pre>

<p>Nice and simple. Now we can move onto PHP:</p>

<pre><code>sudo port install php5 +apache2 +pear
</code></pre>

<p>To enable PHP for Apache:</p>

<pre><code>cd /opt/local/apache2/modules
sudo /opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so
</code></pre>

<p>I like to make some alias commands for starting, restarting and stopping Apache:</p>

<pre><code>mate ~/.bashrc

alias apache-start="sudo /opt/local/apache2/bin/apachectl start"
alias apache-restart="sudo /opt/local/apache2/bin/apachectl restart"
alias apache-stop="sudo /opt/local/apache2/bin/apachectl stop"

source ~/.bashrc
</code></pre>

<p>Now we can make a few changes to the Apache config so that we can use our Sites directory:</p>

<pre><code>sudo mate /opt/local/apache2/conf/httpd.conf
</code></pre>

<p>I&#8217;m using Textmate here (<code>mate</code>), but you can use any editor you wish, like <code>nano</code>.</p>

<p>Change the <code>DocumentRoot</code>:</p>

<pre><code>DocumentRoot "/Users/davidwinter/Sites"
</code></pre>

<p>Then update the <code>&lt;Directory&gt;</code> path to the updated <code>DocumentRoot</code> path.  </p>

<pre><code>&lt;Directory "/Users/davidwinter/Sites"&gt;
</code></pre>

<p>We also want to enable <code>index.php</code> as a directory index file:</p>

<pre><code>&lt;IfModule dir_module&gt;
    DirectoryIndex index.html index.php
&lt;/IfModule&gt;
</code></pre>

<p>And then add the PHP mime type:</p>

<pre><code>&lt;IfModule mime_module&gt;
    ...
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
&lt;/IfModule&gt;
</code></pre>

<p>Now we need to setup the <code>php.ini</code> file:</p>

<pre><code>sudo cp /opt/local/etc/php5/php.ini-development /opt/local/etc/php5/php.ini

sudo mate /opt/local/etc/php5/php.ini
</code></pre>

<p>My <a href="[http://php.net/manual/en/timezones.php">timezone</a> is for London:</p>

<pre><code>date.timezone = Europe/London
</code></pre>

<p>Now we can get onto installing MongoDB (this will install the latest stable version as of time of writing &#8211; 1.2.1): </p>

<pre><code>sudo port install mongodb
</code></pre>

<p>And then the PHP MongoDB extension:</p>

<pre><code>sudo pecl install mongo
</code></pre>

<p>You&#8217;ll need to add the extension to the bottom of your <code>php.ini</code> file:</p>

<pre><code>sudo mate /opt/local/etc/php5/php.ini

extension=mongo.so
</code></pre>

<p>Now startup Apache using the <code>alias</code> created earlier:</p>

<pre><code>apache-start
</code></pre>

<p>If you create a file in your Sites directory, called <code>test.php</code>, and add the following to it:</p>

<pre><code>&lt;?php phpinfo(); ?&gt;
</code></pre>

<p>Then visit the page in your browser; <a href="http://localhost/test.php">http://localhost/test.php</a></p>

<p>You can then scroll down the page and you should see a section titled &#8216;mongo&#8217;. This means the extension is working!</p>

<p>Now we need to startup MongoDB:</p>

<pre><code>mkdir -p ~/data/db
mongod --dbpath ~/data/db/
</code></pre>

<p>Almost there, now a simple MongoDB test in PHP:</p>

<pre><code>&lt;?php
// Connect:
$connection = new Mongo();
// Select database:
$db = $connection-&gt;my_db;
// Select collection:
$films = $db-&gt;films;

$frwl = array(
    'title' =&gt; 'From Russia With Love',
    'year' =&gt; 1963,
    'actor' =&gt; 'Sean Connery'
);
// Save array to collection:
$films-&gt;insert($frwl);

$gf = array(
    'title' =&gt; 'Goldfinger',
    'year' =&gt; 1964,
    'actor' =&gt; 'Sean Connery',
    'girl' =&gt; 'Pussy Galore'
);

$films-&gt;insert($gf);

// Count documents in collection:
if ($films-&gt;count()): ?&gt;
&lt;table&gt;
    &lt;tr&gt;
        &lt;th&gt;Title&lt;/th&gt;
        &lt;th&gt;Year&lt;/th&gt;
        &lt;th&gt;Actor&lt;/th&gt;
        &lt;th&gt;Girl&lt;/th&gt;
    &lt;/tr&gt;
    &lt;?php foreach ($films-&gt;find() as $film): ?&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;?php echo $film['title']; ?&gt;&lt;/td&gt;
        &lt;td&gt;&lt;?php echo $film['year']; ?&gt;&lt;/td&gt;
        &lt;td&gt;&lt;?php echo $film['actor']; ?&gt;&lt;/td&gt;
        &lt;td&gt;&lt;?php echo $film['girl']; ?&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;?php endforeach; ?&gt;
&lt;/table&gt;
&lt;?php endif;
?&gt;
</code></pre>

<p>Very exciting stuff. More to follow.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidwinter.me.uk/articles/2010/01/02/apache-php-and-mongodb-on-mac-os-x-10-6-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>mod_rewrite and Mac OS X Personal Web Sharing</title>
		<link>http://davidwinter.me.uk/articles/2007/05/20/mod_rewrite-and-mac-os-x-personal-web-sharing/</link>
		<comments>http://davidwinter.me.uk/articles/2007/05/20/mod_rewrite-and-mac-os-x-personal-web-sharing/#comments</comments>
		<pubDate>Sun, 20 May 2007 15:24:10 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://davidwinter.me.uk/articles/2007/05/20/mod_rewrite-and-mac-os-x-personal-web-sharing/</guid>
		<description><![CDATA[It was very frustrating installing a fresh WordPress on my Mac and finding that the permalinks didn&#8217;t work. Turns out the default Apache settings for personal web sharing on OS X disable .htaccess overriding. sudo mate /etc/httpd/users/yourusername.conf Now you&#8217;ll want to enable Apache to follow symbolic links: Options Indexes MultiViews FollowSymLinks And to allow .htaccess [...]]]></description>
			<content:encoded><![CDATA[<p>It was very frustrating installing a fresh <a href="http://www.wordpress.org">WordPress</a> on my Mac and finding that the permalinks didn&#8217;t work. Turns out the default Apache settings for personal web sharing on OS X disable <code>.htaccess</code> overriding.</p>

<pre><code>sudo mate /etc/httpd/users/yourusername.conf
</code></pre>

<p>Now you&#8217;ll want to enable Apache to follow symbolic links:</p>

<pre><code>Options Indexes MultiViews FollowSymLinks
</code></pre>

<p>And to allow <code>.htaccess</code> overriding:</p>

<pre><code>AllowOverride All
</code></pre>

<p>The file should then look like:</p>

<pre><code>&lt;Directory "/Users/yourusername/Sites/"&gt;
    Options Indexes MultiViews FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
&lt;/Directory&gt;
</code></pre>

<p>Now in System Preferences, stop and start &#8216;Personal Web Sharing&#8217;. Things should work perfectly now.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidwinter.me.uk/articles/2007/05/20/mod_rewrite-and-mac-os-x-personal-web-sharing/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Subversion 1.4.0 from source via Apache 2.2 on Ubuntu Dapper</title>
		<link>http://davidwinter.me.uk/articles/2006/10/17/subversion-140-from-source-over-apache-22-on-ubuntu-dapper/</link>
		<comments>http://davidwinter.me.uk/articles/2006/10/17/subversion-140-from-source-over-apache-22-on-ubuntu-dapper/#comments</comments>
		<pubDate>Tue, 17 Oct 2006 12:39:42 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[dapper]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://davidwinter.me.uk/articles/2006/10/17/subversion-140-from-source-over-apache-22-on-ubuntu-dapper/</guid>
		<description><![CDATA[This howto assumes you&#8217;ve already followed my Building Apache 2.2 from source article. Now we&#8217;re going to install Subversion 1.4.0 from source so that it can be access via Apache with authentication. Installing Subversion As we&#8217;ve built Apache from source, we&#8217;ll need to do the same for Subversion in order to get the Apache 2 [...]]]></description>
			<content:encoded><![CDATA[<p>This howto assumes you&#8217;ve already followed my <a href="http://davidwinter.me.uk/articles/2006/10/17/building-apache-22-from-source-for-ubuntu-dapper/">Building Apache 2.2 from source</a>  article.</p>

<p>Now we&#8217;re going to install Subversion 1.4.0 from source so that it can be access via Apache with authentication.</p>

<p><span id="more-34"></span></p>

<h3>Installing Subversion</h3>

<p>As we&#8217;ve built Apache from source, we&#8217;ll need to do the same for Subversion in order to get the Apache 2 modules <code>mod_dav_svn</code> and <code>mod_authz_svn</code>.</p>

<pre><code>wget http://subversion.tigris.org/downloads/subversion-1.4.0.tar.gz
tar xvfz subversion-1.4.0.tar.gz
cd subversion-1.4.0/
./configure --prefix=/usr/local --with-apxs=/usr/local/apache2/bin/apxs
make
sudo make install
</code></pre>

<p>This will also add the relevant <code>LoadModule</code> directives into your Apache 2 configuration for you.</p>

<h3>Creating your repository</h3>

<p>Now, create your Subversion repository:</p>

<pre><code>svnadmin create /home/yourusername/subversion/repos
</code></pre>

<p>We have to make that repository owned by Apache so that it can be accessed via the web:</p>

<pre><code>sudo chown -R apache /home/yourusername/subversion/repos
</code></pre>

<h3>Authentication File</h3>

<p>Now create a user/password file for authentication:</p>

<pre><code>htpasswd -cm /home/yourusername/subversion/dav_svn.passwd davidwinter
</code></pre>

<p>When prompted, enter your password.</p>

<h3>Configuring Apache</h3>

<p>Edit your <code>/usr/local/apache2/conf/httpd.conf</code> file with the following placed at the end:</p>

<pre><code>&lt;Location /svn&gt;
  DAV svn
  SVNPath /home/yourusername/subversion/repos

  AuthType Basic
  AuthName "Subversion Repository"
  AuthUserFile /home/yourusername/subversion/dav_svn.passwd
  Require valid-user
&lt;/Location&gt;
</code></pre>

<p>If you want access control based on different users, add the following line after the <code>Require valid-user</code> line:</p>

<pre><code>AuthzSVNAccessFile /home/yourusername/subversion/svn_access_control
</code></pre>

<p>Save the file. Start Apache. To find out what you need to put in the <code>svn_access_control</code> file, read <a href="http://davidwinter.me.uk/articles/2006/03/03/access-control-for-subversion-with-apache2-and-authz/">my previous Subversion authentication article here</a>. for params.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidwinter.me.uk/articles/2006/10/17/subversion-140-from-source-over-apache-22-on-ubuntu-dapper/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Building Apache 2.2 from source for Ubuntu Dapper</title>
		<link>http://davidwinter.me.uk/articles/2006/10/17/building-apache-22-from-source-for-ubuntu-dapper/</link>
		<comments>http://davidwinter.me.uk/articles/2006/10/17/building-apache-22-from-source-for-ubuntu-dapper/#comments</comments>
		<pubDate>Tue, 17 Oct 2006 12:25:12 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[dapper]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://davidwinter.me.uk/articles/2006/10/17/building-apache-22-from-source-for-ubuntu-dapper/</guid>
		<description><![CDATA[Two reasons you might want to do this. You want to host a Rails application using Mongrel via Apache and mod_proxy_balancer. You&#8217;re studying in a Website administration module for your 3rd year Software Engineering degree :) Seriously though, if you don&#8217;t want to use mod_proxy_balancer, just do a normal apt-get install of Apache 2 and [...]]]></description>
			<content:encoded><![CDATA[<p>Two reasons you might want to do this.</p>

<ol>
<li>You want to host a Rails application using Mongrel via Apache and <code>mod_proxy_balancer</code>.</li>
<li>You&#8217;re studying in a Website administration module for your 3rd year Software Engineering degree :)</li>
</ol>

<p>Seriously though, if you don&#8217;t want to use <code>mod_proxy_balancer</code>, just do a normal <code>apt-get install</code> of Apache 2 and you&#8217;ll be fine. <code>mod_proxy_balancer</code> is only available for Apache 2.2, and currently, that&#8217;s not available from the Ubuntu repositories via <code>apt-get</code>.</p>

<p>This article only covers installing Apache 2.2 &#8211; I&#8217;ll write another one for getting Subversion and PHP working shortly afterwards.</p>

<p><span id="more-33"></span></p>

<h3>Workspace</h3>

<p>If you&#8217;ve not got the <code>build-essential</code> package installed yet:</p>

<pre><code>sudo apt-get install build-essential
</code></pre>

<p>It&#8217;s best to keep all of the source files in a seperate directory so they don&#8217;t mess up your home directory.</p>

<pre><code>cd
mkdir src
cd src
</code></pre>

<h3>Zlib</h3>

<p>So that Apache can compress output to browsers that support it, we&#8217;re going to install Zlib first of all:</p>

<pre><code>wget http://www.zlib.net/zlib-1.2.3.tar.gz
tar xvfz zlib-1.2.3.tar.gz
cd zlib-1.2.3/
./configure --prefix=/usr/local
make
sudo make install
</code></pre>

<h3>Apache 2.2</h3>

<p>Now download the Apache 2.2 source files:</p>

<pre><code>cd ..
wget http://apache.rmplc.co.uk/httpd/httpd-2.2.3.tar.gz
</code></pre>

<p>Extract and move into the directory:</p>

<pre><code>tar xvfz httpd-2.2.3.tar.gz
cd httpd-2.2.3/
</code></pre>

<p>Now to configure the build of Apache 2.2 that we want:</p>

<pre><code>./configure --prefix=/usr/local/apache2 --enable-mods-shared=all --enable-deflate --enable-proxy --enable-proxy-balancer --enable-proxy-http
</code></pre>

<p>Besides setting the modules we&#8217;d like installed, and the location of the install, this paramater <code>--enable-mods-shared=all</code> is telling Apache 2.2 to build modules so that they can be dynamically loaded when it is started. This means, we can add further modules to our Apache 2.2 install when we like &#8211; as we will do with the Subversion modules and PHP.</p>

<p>Once the configuration is complete:</p>

<pre><code>make
sudo make install
</code></pre>

<p>Let&#8217;s test that it&#8217;s working:</p>

<pre><code>sudo /usr/local/apache2/bin/apachectl start
</code></pre>

<p>Now navigate to <a href="http://localhost">http://localhost</a> and you should see a message saying &#8220;It works!&#8221;.</p>

<p>Stop Apache:</p>

<pre><code>sudo /usr/local/apache2/bin/apachectl stop
</code></pre>

<h3>Apache at start-up</h3>

<p>Now let&#8217;s get Apache to start at boot time automatically:</p>

<pre><code>sudo cp /usr/local/apache2/bin/apachectl /etc/init.d/apachectl
sudo chmod +x /etc/init.d/apachectl
</code></pre>

<p>What we&#8217;re doing here is copying the Apache Control script into the start-up directory.</p>

<p>We just need to add a few lines to the file for it to work nicely:</p>

<pre><code>sudo nano /etc/init.d/apachectl
</code></pre>

<p>Add the followinig, so the top of the file looks like:</p>

<pre><code>#!/bin/sh
#
# chkconfig: - 85 15
# description: Apache is a web server.
</code></pre>

<p>Save the file. </p>

<p>Now we need to register it with the start-up manager:</p>

<pre><code>sudo /usr/sbin/update-rc.d apachectl defaults
</code></pre>

<h3>Securing Apache</h3>

<p>It&#8217;s also a good idea to create a dedicate Apache system user account. It&#8217;ll make your install much more secure.</p>

<pre><code>sudo adduser --system apache
</code></pre>

<p>Now we just need to make sure that Apache runs under this user. We do that by editting the configuration file:</p>

<pre><code>sudo nano /usr/local/apache2/conf/httpd.conf
</code></pre>

<p>You need to find the lines that say:</p>

<pre><code>User daemon
Group daemon
</code></pre>

<p>And change them so they look like:</p>

<pre><code>User apache
Group nogroup
</code></pre>

<p>Save the file.</p>

<p>Now, let&#8217;s start Apache:</p>

<pre><code>sudo /usr/local/apache2/bin/apachectl start
</code></pre>

<p>Now to check it&#8217;s running under the new user, <code>apache</code>:</p>

<pre><code>ps -aux | grep httpd
</code></pre>

<p>If you see the word <code>apache</code> in there, it&#8217;s working.</p>

<h3>Check it&#8217;s all working</h3>

<p>Now just reboot the system and before logging in, check on another machine by visiting the servers IP in the web browser and you should see the &#8220;It works!&#8221; message. This means Apache started up correctly automatically.</p>

<p>Building Apache 2.2 from source. Done.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidwinter.me.uk/articles/2006/10/17/building-apache-22-from-source-for-ubuntu-dapper/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Ubuntu Dapper Web Server How-to</title>
		<link>http://davidwinter.me.uk/articles/2006/08/09/ubuntu-dapper-web-server-how-to/</link>
		<comments>http://davidwinter.me.uk/articles/2006/08/09/ubuntu-dapper-web-server-how-to/#comments</comments>
		<pubDate>Wed, 09 Aug 2006 09:11:32 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[dapper]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://davidwinter.me.uk/articles/2006/10/13/ubuntu-dapper-web-server-how-to/</guid>
		<description><![CDATA[It&#8217;s finally here, my updated how-to on how to get Ubuntu Dapper up and running as a home web server. Perfect for hosting those small web sites and blogs. My original Ubuntu 5.10 web server how-to is still available. This updated version is very similar to the 5.10 how-to, however, there are a few changes [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s finally here, my updated how-to on how to get Ubuntu Dapper up and running as a home web server. Perfect for hosting those small web sites and blogs. My original <a href="http://davidwinter.me.uk/articles/2006/02/05/ubuntu-5-10-web-server-howto">Ubuntu 5.10 web server how-to</a> is still available.</p>

<p>This updated version is very similar to the 5.10 how-to, however, there are a few changes required. The following changes have been made:</p>

<ul>
<li>Setting up the Multiverse and Universe repositories</li>
<li>The packages to install Ruby</li>
<li>Setting a symbolic link for Ruby</li>
<li>Updating rubygems</li>
<li>Clearing the rubygems cache</li>
</ul>

<p>Other than those, the rest of the how-to is the same as the Breezy how-to. </p>

<p><span id="more-30"></span></p>

<p>This how-to assumes that you have a clean install of Ubuntu Dapper (I&#8217;m not currently using Ubuntu Dapper Server, just the <strong>basic desktop install</strong>).</p>

<p>The first thing to do, is get <code>ssh</code> installed so that if you like, you can connect and do all of this remotely.</p>

<pre><code>sudo apt-get install ssh
</code></pre>

<p>There are some packages that are needed that aren&#8217;t in the default repositories for <code>apt</code>, so you have to enable them manually. Universe and Multiverse are needed.</p>

<p>To enable them, open up the Synaptic Package Manager</p>

<ol>
<li>Settings</li>
<li>Repositories</li>
<li>Add</li>
<li>Ensure that &#8216;Ubuntu 6.06 LTS&#8217; is the selected &#8216;Channel&#8217;</li>
<li>Check &#8216;Community maintained (Universe)&#8217;</li>
<li>Check &#8216;Non-free (Multiverse)</li>
<li>Click OK and let it rescan the servers.</li>
</ol>

<p>You can then close Synaptic. <code>apt</code> is now all set up ready for installing the packages we need.</p>

<p>Before we start installing the packages we want, do a system update:</p>

<pre><code>sudo apt-get update
</code></pre>

<h3>Ruby</h3>

<p>All on one line:</p>

<pre><code>sudo apt-get install irb libdbm-ruby libfcgi-ruby1.8 libgdbm-ruby libmysql-ruby libopenssl-ruby libruby1.8-dbg ri ruby1.8-dev
</code></pre>

<p>In order for Ruby to work ok, do the following:</p>

<pre><code>sudo ln -s /usr/bin/ruby1.8 /usr/bin/ruby
</code></pre>

<p>This will add a symbolic link into your <code>/usr/bin</code> directory so that the command <code>ruby</code> works, as opposed to <code>ruby1.8</code>.</p>

<h3>MySQL Server</h3>

<pre><code>sudo apt-get install mysql-server
</code></pre>

<p>During this install, a Postfix config screen will appear. Select OK and then &#8220;No configuration&#8221;.</p>

<h3>Ruby Gems &amp; Rails</h3>

<p>This is the standard way of installing ruby applications.</p>

<p>Need to download it directly from its web site:</p>

<pre><code>wget http://rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz
</code></pre>

<p>Then extract it:</p>

<pre><code>tar xvfz rubygems-0.8.11.tgz
</code></pre>

<p>Move into the extracted directory:</p>

<pre><code>cd rubygems-0.8.11
</code></pre>

<p>Run the setu-p program:</p>

<pre><code>sudo ruby1.8 setup.rb
</code></pre>

<p>Update all installed gems on the system:</p>

<pre><code>sudo gem update --system
</code></pre>

<p>Take note that there are two dashes preceding <code>system</code>.</p>

<p>Now that Ruby Gems is installed, we can install Rails. However, I encountered problems with this and had to clear my rubygems cache first. Do the following:</p>

<pre><code>gem env gemdir
</code></pre>

<p>This will output a path location which you&#8217;ll need to use for the next command. For me, it was and probably is the same for you, <code>/usr/lib/ruby/gems/1.8</code></p>

<pre><code>sudo rm ABOVE_PATH/source_cache
</code></pre>

<p>This will clear your rubygems cache. Now you shouldn&#8217;t have any problems with installing rails.</p>

<pre><code>sudo gem install rails -y
</code></pre>

<h3>Apache 2</h3>

<p>Next is the web server I&#8217;m using. Apache 2. The following command will install Apache 2, FastCGI, FCGI, PHP 5 with MySQL functionality. PHP isn&#8217;t needed for Ruby or Rails, but I&#8217;m including it so that I can run PHP apps&#8230;</p>

<pre><code>sudo apt-get install apache2 libapache2-mod-fcgid libapache2-mod-fastcgi libapache2-mod-php5 php5-mysql
</code></pre>

<p>Once that&#8217;s done, we&#8217;ll need to enable the Apache mods we&#8217;ll be using:</p>

<pre><code>sudo a2enmod fcgid
sudo a2enmod fastcgi
sudo a2enmod rewrite
</code></pre>

<p>You&#8217;ll notice I&#8217;ve installed two different types of Fast CGI. That&#8217;s because at some point I want to try them both out. However, at the moment, I&#8217;ve only had success with getting FastCGI working decently.</p>

<p>Restart Apache to make sure all is well.</p>

<pre><code>sudo /etc/init.d/apache2 restart
</code></pre>

<h3>FastCGI</h3>

<p>I thought FastCGI would have been installed after doing the libapache2-mod-fastcgi &#8211; but for some reason, you have to install it manually.</p>

<p>In order to configure and build from the source files, you need to download some basic files:</p>

<pre><code>sudo apt-get install build-essential
</code></pre>

<p>Then, grab the FastCGI files from the web site:</p>

<pre><code>wget http://fastcgi.com/dist/fcgi-2.4.0.tar.gz
</code></pre>

<p>Extract:</p>

<pre><code>tar xvfz fcgi-2.4.0.tar.gz
</code></pre>

<p>Move into the directory:</p>

<pre><code>cd fcgi-2.4.0
</code></pre>

<p>Configure the installer:</p>

<pre><code>./configure
</code></pre>

<p>Install:</p>

<pre><code>sudo make install
</code></pre>

<p>Now, that is all of the Apache and FastCGI files installed. Later, we&#8217;ll need to configure it all.</p>

<h3>Webmin</h3>

<p>Webmin is ugly, but it works, and it lets us configure Apache and the Nameserver easily.</p>

<p>Go to http://www.webmin.com/ and download the latest version of webmin in tar.gz format.</p>

<p>Once downloaded, extract it (filename may vary depending on the version you download):</p>

<pre><code>tar xvfz webmin-1.260.tar.gz
</code></pre>

<p>Move into the directory:</p>

<pre><code>cd webmin-1.260
</code></pre>

<p>Run the set-up program:</p>

<pre><code>sudo ./setup.sh /usr/local/webmin
</code></pre>

<p>You can use the default settings for this, or change them if you know what you&#8217;re doing. Be sure to set a password you can remember.</p>

<p>At the end of the set-up you&#8217;ll be given an address to use to connect to webmin. Remember this! and go to it straight away and login.</p>

<p>Do the following to configure Webmin to work with Apache:
1. At the top, click on the &#8220;Servers&#8221; link.
2. Select Apache Webserver.
3. Select Module Config.
4. Set the following values:
    * Apache Server Root &#8211; /etc/apache2
    * Path to httpd executable &#8211; /usr/sbin/apache2
    * Path to httpd.conf &#8211; /etc/apache2/httpd.conf
    * Command to start Apache &#8211; /etc/init.d/apache2 start
    * Command to stop Apache &#8211; /etc/init.d/apache2 stop</p>

<p>Save these settings.</p>

<h3>Nameserver</h3>

<p>I&#8217;m no DNS expert, so this is very vague and I suggest you go read a howto on DNS&#8230; <a href="http://rimuhosting.com/support/bindviawebmin.jsp">here&#8217;s one</a> I used to complete this part.</p>

<p>This will be different depending on your set-ups. For me, I have my domain name pointing to my web server in America that hosts http://commanderbond.net </p>

<p>On the server, there, I have the DNS pointing to my Internet IP at home, here in the UK.</p>

<p>The nameserver I&#8217;m using is Bind.</p>

<pre><code>sudo apt-get install bind9
</code></pre>

<p>Once that&#8217;s installed, we need to configure it in Webmin.
1. Click the &#8220;Servers&#8221; link.
2. Select BIND DNS Server.
3. A message will appear about a configuration file. Select the 3rd option &#8220;Setup as an internet name server, but use Webmin&#8217;s older root server information&#8221;
4. Create a Master Zone and enter the following details:
    * Domain Name &#8211; yourdomain.com
    * Email &#8211; you@anemail.com
5. Click on &#8220;Create&#8221;.
6. Click on the &#8220;Address&#8221; link.
7. Create a new Address record using the following:
    * Name &#8211; yourdomain.com. (including the trailing dot)
    * Address &#8211; your Internet IP address
8. Click on &#8220;Create&#8221;.
9. Go to the Module Index.
10. Click on &#8220;Apply Changes&#8221;.</p>

<h3>Set-up your web site</h3>

<p>You&#8217;ll need somewhere to store your web site files, so I suggest to first of all create a <code>public_html</code> directory in your user directory.</p>

<pre><code>mkdir ~/public_html
</code></pre>

<p>Now we&#8217;ll create a test HTML file to check all is working so far.</p>

<pre><code>nano ~/public_html/index.html
</code></pre>

<p>Inside it put the following:</p>

<pre><code>&lt;p&gt;Hopefully you can see this...&lt;/p&gt;
</code></pre>

<p>Save the file using Control O and then Control X to quit Nano.</p>

<p>Now, set the permissions of the file so it&#8217;s visible to the world:</p>

<pre><code>chmod 644 ~/public_html/index.html
</code></pre>

<p>In Webmin, go to the Apache configuration.</p>

<p>Create a new Virtual Server with the following:
* Document Root &#8211; home/yourusername/public_html
* Server Name &#8211; yourdomain.com</p>

<p>Save the settings. Now restart Apache:</p>

<pre><code>sudo /etc/init.d/apache2 restart
</code></pre>

<p>Now visit http://yourdomain.com/~yourusername/ and you should see:</p>

<blockquote>
  <p>Hopefully you can see this&#8230;</p>
</blockquote>

<p>If so, excellent! If not, hmmm&#8230; maybe you didn&#8217;t follow everything? or I made a mistake somewhere&#8230; leave a comment below.</p>

<p>Take a 5 minute break!</p>

<p>Refreshed? Right. Moving on&#8230;</p>

<h3>phpMyAdmin for MySQL management</h3>

<p>Go to http://www.phpmyadmin.net/home_page/index.php and download the latest stable release of phpMyAdmin in tar.gz format.</p>

<p>Extract:</p>

<pre><code>tar xvfz phpMyAdmin-2.7.0-pl2.tar.gz
</code></pre>

<p>Move the directory to some place helpful:</p>

<pre><code>mv phpMyAdmin-2.7.0-pl2 ~/phpmyadmin
</code></pre>

<p>Move into that directory:</p>

<pre><code>cd ~/phpmyadmin/
</code></pre>

<p>Create a new configuration file:</p>

<pre><code>cp config.default.php config.inc.php
</code></pre>

<p>Change the authentication mode to http</p>

<pre><code>gedit config.inc.php
</code></pre>

<p>Change this line:</p>

<pre><code>$cfg['Servers'][$i]['auth_type'] = 'config';
</code></pre>

<p>&#8230;to this line:</p>

<pre><code>$cfg['Servers'][$i]['auth_type'] = 'http';
</code></pre>

<p>Save the file.</p>

<p>Back in the command line, we need to set the root password, because by default, there isn&#8217;t one! </p>

<pre><code>mysql -u root
</code></pre>

<p>You&#8217;ll then enter the MySQL console. Enter the following:</p>

<pre><code>UPDATE mysql.user SET Password=PASSWORD('newpasswordhere') WHERE User='root';
</code></pre>

<p>This will set the root password. Now flush the privileges:</p>

<pre><code>FLUSH PRIVILEGES;
</code></pre>

<p>Now exit:</p>

<pre><code>exit
</code></pre>

<p>Now, we want phpMyAdmin accessible on the server &#8216;globally&#8217;. So that it doesn&#8217;t matter what address we&#8217;re using, we&#8217;ll still be able to access it.</p>

<p>In Webmin, under Apache Webserver:
1. Select &#8220;Default Server&#8221;
2. Aliases and Redirects
3. Under &#8220;Document directory aliases&#8221; enter <code>/phpmyadmin/</code> into the first text box, and <code>/home/davidwinter/phpmyadmin/</code> into the box to the right of that one.</p>

<p>Save, and in the Terminal restart apache:</p>

<pre><code>sudo /etc/init.d/apache2 restart
</code></pre>

<p>Go to http://yourdomain.com/phpmyadmin/</p>

<p>Login in using &#8220;root&#8221; and the password you set in the MySQL console.</p>

<p>You can do any MySQL configuration here. For me, I restored my Typo database for this blog from a backup.</p>

<h3>FastCGI configuration with a Rails application</h3>

<p>This part is what gets a Rails app running really fast.</p>

<p>You&#8217;ll need to configure the FastCGI config file:</p>

<pre><code>sudo nano /etc/apache2/mods-enabled/fastcgi.conf
</code></pre>

<p>Here is my config file:</p>

<pre><code>&lt;IfModule mod_fastcgi.c&gt;
  #FastCgiWrapper /usr/lib/apache2/suexec2
  FastCgiIpcDir /var/lib/apache2/fastcgi
  FastCgiConfig -maxClassProcesses 2 -maxProcesses 2 -minProcesses 2 -processSlack 2
  FastCgiServer /home/davidwinter/typo/public/dispatch.fcgi -idle-timeout 120 -processes 2 -initial-env RAILS_ENV=production
&lt;/IfModule&gt;
</code></pre>

<p>The following line of the above:</p>

<pre><code>FastCgiServer /home/davidwinter/typo/public/dispatch.fcgi -idle-timeout 120 -processes 2 -initial-env RAILS_ENV=production
</code></pre>

<p>Is important. You need to specifiy a line like this for each Rails app you&#8217;ll be using under FastCGI.</p>

<p>Now, in your Rails application directory check that in <code>public/.htaccess</code> has this line:</p>

<pre><code>AddHandler fastcgi-script .fcgi
</code></pre>

<p>And, that in the rewrite rules section, it has this:</p>

<pre><code>RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
</code></pre>

<p>&#8230;instead of:</p>

<pre><code>RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
</code></pre>

<p>Notice <code>.fcgi</code> instead of <code>.cgi</code></p>

<p>And that&#8217;s about it!</p>

<p>Give Apache one final restart:</p>

<pre><code>sudo /etc/init.d/apache2 restart
</code></pre>

<p>And you should now have everything working.</p>

<p>As I said, any problems, leave a comment and I&#8217;ll try and help.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidwinter.me.uk/articles/2006/08/09/ubuntu-dapper-web-server-how-to/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Access Control for Subversion with Apache2 and Authz</title>
		<link>http://davidwinter.me.uk/articles/2006/03/03/access-control-for-subversion-with-apache2-and-authz/</link>
		<comments>http://davidwinter.me.uk/articles/2006/03/03/access-control-for-subversion-with-apache2-and-authz/#comments</comments>
		<pubDate>Fri, 03 Mar 2006 09:05:03 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[uni]]></category>

		<guid isPermaLink="false">http://davidwinter.me.uk/articles/2006/10/13/access-control-for-subversion-with-apache2-and-authz/</guid>
		<description><![CDATA[My group project at University now consists of three smaller projects that provide an overall RSS service. I want to let the guys work on these, while still letting me keep my other coursework jut accessible to me. At the moment, I just have basic http authentication set-up which isn&#8217;t so great for pulling off [...]]]></description>
			<content:encoded><![CDATA[<p>My group project at University now consists of three smaller projects that provide an overall RSS service. I want to let the guys work on these, while still letting me keep my other coursework jut accessible to me. At the moment, I just have basic http authentication set-up which isn&#8217;t so great for pulling off what I want. </p>

<p>Please welcome on stage the Apache2 mod, <code>authz_svn</code>&#8230;</p>

<p><span id="more-22"></span></p>

<p>If you followed my other <a href="http://davidwinter.me.uk/articles/2006/02/16/subversion-over-apache-2-on-ubuntu">howto</a>, you&#8217;ll have all the pre-requisites for this.</p>

<p>First of all, we need to create an Access Control file.</p>

<pre><code>sudo nano /etc/apache2/svn_access_control
</code></pre>

<p>In this file, you&#8217;ll want to put some rules. I&#8217;ll first of all go over these and then provide some examples.</p>

<h3>Permissions</h3>

<p>There are only two types of permission:</p>

<ul>
<li>Read only &#8211; <code>r</code> &#8211; a user can check-out a copy of a project.</li>
<li>Read and Write &#8211; <code>rw</code> &#8211; a user can check-out and commit changes to a project.</li>
</ul>

<h3>Users</h3>

<p>These are the same usernames that you have set in your password file that you created in the previous <a href="http://davidwinter.me.uk/articles/2006/02/16/subversion-over-apache-2-on-ubuntu">howto</a>. You can always add more users to this file using:</p>

<pre><code>sudo htpasswd2 -m /etc/apache2/dav_svn.passwd bill
</code></pre>

<p>When prompted, enter the password for the user.</p>

<h3>Repository Location</h3>

<p>You specify the above rules in certain locations for the repository. These go between square brackets.</p>

<pre><code>[/]
</code></pre>

<p>The above will specify rules for the root of the repository.</p>

<pre><code>[/wowapp/trunk]
</code></pre>

<p>The above will specify rules for a project named &#8216;wowapp&#8217; in the trunk location.</p>

<h3>User Groups</h3>

<p>You can create groups of users and then use those for rules. You do this under a special heading in square brackets:</p>

<pre><code>[groups]
mygroup = dave, mike
</code></pre>

<p>This will create a group called &#8216;mygroup&#8217; which &#8216;dave&#8217; and &#8216;mike&#8217; belongs to.</p>

<p>And now for some examples.</p>

<h3>Examples</h3>

<pre><code>[groups]
team = bob, bill
devteam = bob, barry, brett

[/]
@team = r
bob = rw

[/wowapp/trunk]
@team = r
@devteam = rw
brenda = rw
</code></pre>

<p>In this example:</p>

<ul>
<li>Created a group <code>team</code> which has two members; <code>bob</code> and <code>bill</code>.</li>
<li>Created another group, called <code>devteam</code> which has three members; <code>bob</code>, <code>barry</code>, <code>brett</code>.</li>
<li>In the root of the repository, I&#8217;ve given the group <code>team</code> read permissions.</li>
<li>Also, in the root, <code>bob</code> has read and write permissions.</li>
<li>In the trunk of <code>wowapp</code>, the group <code>team</code> has read permission. </li>
<li>Also, the <code>devteam</code> group has read and write permissions.</li>
<li>And another user, called <code>brenda</code> has read and write permissions.</li>
</ul>

<p>Once you&#8217;ve created your desired access controll file, save the changes in nano by hitting <code>CTRL O</code>, hit enter to save the name, then <code>CTRL X</code> to quit Nano.</p>

<p>We just need to now link this access control file with our Subversion set-up.</p>

<pre><code>sudo nano /etc/apache2/mods-enabled/dav_svn.conf
</code></pre>

<p>Here&#8217;s the example from the previous how-to:</p>

<pre><code>&lt;Location /svn&gt;
  DAV svn
  SVNPath /home/svn

  AuthType Basic
  AuthName "Subversion Repository"
  AuthUserFile /etc/apache2/dav_svn.passwd
  Require valid-user
&lt;/Location&gt;
</code></pre>

<p>All you need to add is the following line:</p>

<pre><code>AuthzSVNAccessFile /etc/apache2/svn_access_control
</code></pre>

<p>So that the file looks like this:</p>

<pre><code>&lt;Location /svn&gt;
  DAV svn
  SVNPath /home/svn

  AuthType Basic
  AuthName "Subversion Repository"
  AuthUserFile /etc/apache2/dav_svn.passwd

  AuthzSVNAccessFile /etc/apache2/svn_access_control

  Require valid-user
&lt;/Location&gt;
</code></pre>

<p>Save the file, and then restart Apache2:</p>

<pre><code>sudo /etc/init.d/apache2 restart
</code></pre>

<p>You should now have access control working for Subversion over Apache2.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidwinter.me.uk/articles/2006/03/03/access-control-for-subversion-with-apache2-and-authz/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Subversion over Apache 2 on Ubuntu</title>
		<link>http://davidwinter.me.uk/articles/2006/02/16/subversion-over-apache-2-on-ubuntu/</link>
		<comments>http://davidwinter.me.uk/articles/2006/02/16/subversion-over-apache-2-on-ubuntu/#comments</comments>
		<pubDate>Thu, 16 Feb 2006 09:01:26 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://davidwinter.me.uk/articles/2006/10/13/subversion-over-apache-2-on-ubuntu/</guid>
		<description><![CDATA[If your one of my regular readers (ha!), then you&#8217;ll know I&#8217;m starting a Group Project for University. We have 7 members in the group and without some sort of version control &#8211; managing the code we&#8217;re about to produce would be hell! So I&#8217;m setting up Subversion on my home server as a repository. [...]]]></description>
			<content:encoded><![CDATA[<p>If your one of my regular readers (ha!), then you&#8217;ll know I&#8217;m starting a Group Project for University. We have 7 members in the group and without some sort of version control &#8211; managing the code we&#8217;re about to produce would be hell! So I&#8217;m setting up Subversion on my home server as a repository. Following are the steps I used to set-up Subversion over Apache 2 on my Ubuntu server.</p>

<p><span id="more-17"></span></p>

<p>I&#8217;m assuming you have Apache 2 already set-up. The only extra packages to download and install are <code>subversion</code> and <code>libapache2-svn</code>.</p>

<pre><code>sudo apt-get install subversion libapache2-svn
</code></pre>

<p>This will download and install Subversion and the SVN module for Apache 2. The module itself uses WebDAV to transmit files between Subversion &#8211; so this means everything can go across port 80 without the hassle of having to worry about a firewall.</p>

<p>The install should automatically enable the module, but just to check:</p>

<pre><code>sudo a2enmod dav_svn
</code></pre>

<p>It should come up saying it&#8217;s already enabled. If not, it will enable it for you.</p>

<p>You&#8217;ll need to configure Apache now:</p>

<pre><code>sudo nano /etc/apache2/mods-enabled/dav_svn.conf
</code></pre>

<p>Edit the file to look something like this:</p>

<pre><code>&lt;Location /svn&gt;
  DAV svn
  SVNPath /home/svn

  AuthType Basic
  AuthName "Subversion Repository"
  AuthUserFile /etc/apache2/dav_svn.passwd
  Require valid-user
&lt;/Location&gt;
</code></pre>

<p>Change <code>/home/svn</code> to whatever the location of your repository is. If you haven&#8217;t created one yet, then do:</p>

<pre><code>sudo mkdir /home/svn
sudo svnadmin create /home/svn
</code></pre>

<p>Now, you need to make Apache the owner of the repository:</p>

<pre><code>sudo chown -R www-data /home/svn
</code></pre>

<p>To secure Subversion, do the following to create a password file:</p>

<pre><code>sudo htpasswd2 -cm /etc/apache2/dav_svn.passwd bob
</code></pre>

<p>Replace <code>bob</code> with whatever username you want to use, and then when prompted enter a password.</p>

<p>Now restart Apache:</p>

<pre><code>sudo /etc/init.d/apache2 restart
</code></pre>

<p>That should now all be set-up. You can try it by visiting your server <code>http://you.server/svn</code>. You should get a username/password dialog which you enter the details you created.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidwinter.me.uk/articles/2006/02/16/subversion-over-apache-2-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>54</slash:comments>
		</item>
		<item>
		<title>Subdomains with Apache 2</title>
		<link>http://davidwinter.me.uk/articles/2006/02/14/subdomains-with-apache-2/</link>
		<comments>http://davidwinter.me.uk/articles/2006/02/14/subdomains-with-apache-2/#comments</comments>
		<pubDate>Tue, 14 Feb 2006 09:00:16 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://davidwinter.me.uk/articles/2006/10/13/subdomains-with-apache-2/</guid>
		<description><![CDATA[This semester at university I&#8217;m doing a group project module. Most of the group are on IRC a lot of the time, but it doesn&#8217;t really provide for reliable collaboration. I&#8217;d seen punBB being used a lot in recent months and knew it was basically a no-frills discussion forum that was really fast (and it [...]]]></description>
			<content:encoded><![CDATA[<p>This semester at university I&#8217;m doing a group project module. Most of the group are on IRC a lot of the time, but it doesn&#8217;t really provide for reliable collaboration. I&#8217;d seen punBB being used a lot in recent months and knew it was basically a no-frills discussion forum that was really fast (and it validates as XHTML Strict! woo!). I&#8217;ve been wanting to give it a shot for ages &#8211; and this was my excuse. Thing is, with this blog being here, I&#8217;d have to create a sub-domain to use.</p>

<p><span id="more-15"></span></p>

<p>First of all, I updated the DNS records on my American server (which manages this domains DNS) so that it included a wildcard record.</p>

<pre><code>*.davidwinter.me.uk. A 123.456.789.000
</code></pre>

<p>This means that any request to a sub-domain gets forwarded onto my server here at home. It&#8217;s a ton easier than having to set up each sub-domain a separate name record.</p>

<p>However, my good friend Greg told me that it&#8217;s important to also include a record for the domain name itself:</p>

<pre><code>davidwinter.me.uk. A 123.456.789.000
</code></pre>

<p>With that all set up, and changes applied &#8211; I moved onto configuring my server at home.</p>

<p>I won&#8217;t bore you with all the problems I had getting this set-up correct. But in a sentence, the problem I was having was that only the first virtual server was displayed regardless of what sub-domain I used.</p>

<p>The solution?</p>

<p>In the Apache config file (httpd.conf), place this at the very top:</p>

<pre><code>NameVirtualHost 192.168.0.1:80
</code></pre>

<p>Where <code>192.168.0.1</code> is the internal IP of your server running Apache.</p>

<p>Then, for each virtual host entry in the configuration file, set them up using:</p>

<pre><code>&lt;VirtualHost 192.168.0.1:80&gt;
</code></pre>

<p>Using the same internal IP you specified in <code>NameVirtualHost</code>.</p>

<p>Save the file and restart Apache. All should work fine.</p>

<p>For my set-up, I still added DNS records for the sub-domains locally on my home server so that I could use the domains on my internal network.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidwinter.me.uk/articles/2006/02/14/subdomains-with-apache-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
