<?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>Web Design London - Energy House Digital &#187; Linux</title>
	<atom:link href="http://web-design-london.biz/category/web/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://web-design-london.biz</link>
	<description>Blog</description>
	<lastBuildDate>Wed, 14 Oct 2009 11:18:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Lighttpd/PHP/MySQL for Low RAM applications</title>
		<link>http://web-design-london.biz/web/lighttpdphpmysql-for-low-ram-applications/</link>
		<comments>http://web-design-london.biz/web/lighttpdphpmysql-for-low-ram-applications/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 14:54:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://web-design-london.biz/?p=3</guid>
		<description><![CDATA[The point of this article is to demonstrate how to install and optimise Lighttpd, PHP5 and MySQL under Debian (My system runs &#8216;Etch&#8217;).
If you feel I&#8217;ve missed anything in this article, or have made an error, get in touch.
Ok, so let&#8217;s grab lighttpd, php and MySQL
apt-get install lighttpd php5-cgi php5-cli php5-mysql mysql-server
You may want to [...]]]></description>
			<content:encoded><![CDATA[<p>The point of this article is to demonstrate how to install and optimise <a href="http://lighttpd.net">Lighttpd</a>, PHP5 and MySQL under Debian (My system runs &#8216;Etch&#8217;).</p>
<p>If you feel I&#8217;ve missed anything in this article, or have made an error, get in touch.</p>
<p>Ok, so let&#8217;s grab lighttpd, php and MySQL</p>
<pre>apt-get install lighttpd php5-cgi php5-cli php5-mysql mysql-server</pre>
<p>You may want to add any other php modules that you may require, such as php5-curl, php5-gd etc.</p>
<p>Next, as lighttpd automatically assumes you&#8217;re using php4, we need to update the fastcgi php path in:</p>
<pre>/etc/lighttpd/conf-available/10-fastcgi.conf</pre>
<p>Look for the line</p>
<pre>"bin-path" =&gt; "/usr/bin/php4-cgi",</pre>
<p>and replace it with</p>
<pre>"bin-path" =&gt; "/usr/bin/php5-cgi",</pre>
<p>Simple.</p>
<p>While you have the file open, change
<pre>"max-procs" => 2,</pre>
<p>  and</p>
<pre>"PHP_FCGI_CHILDREN" => "2",</pre>
<p>This will reduce the number of waiting fastcgi instances, thus reducing ram. If you have a particularly busy site, you may want to either leave this, or perhaps even increase it.</p>
<p>Now enable fastcgi module in lighttpd</p>
<pre>lighty-enable-mod fastcgi</pre>
<p>Restart lighttpd</p>
<pre>/etc/init.d/lighttpd restart</pre>
<p>You now have lighttpd running perfectly with php5.</p>
<p>You might now want to add some virtual hosts. For example purposes, we&#8217;ll call these <strong>foo.com</strong> and <strong>bar.net</strong></p>
<p>Create your directory structure:</p>
<pre>mkdir /home/sites/foo.com
mkdir -p /home/sites/foo.com/http
mkdir -p /home/sites/foo.com/logs

mkdir /home/sites/bar.net
mkdir -p /home/sites/bar.net/http
mkdir -p /home/sites/logs</pre>
<p>Give ownership of the logs directory to the web server</p>
<pre>chown www-data /home/sites/foo.com/logs
chown www-data /home/sites/bar.net/logs</pre>
<p>Once we&#8217;ve done this, we can sort out the config side of things.<br />
Open up</p>
<pre>/etc/lighttpd/lighttpd.conf</pre>
<p>Include the configuration files you&#8217;ll use for each of your domains</p>
<pre>include "foo.com.conf"
include "bar.net.conf"</pre>
<p>Now open up
<pre>/etc/lighttpd/foo.com.conf</pre>
<p> and add</p>
<pre>$HTTP["host"] =~ "foo\.com" {
server.document-root = "/home/sites/foo.com/http"
accesslog.filename         = "/home/sites/foo.com/logs/access.log"
}
</pre>
<p>and the same for
<pre>bar.net.conf</pre>
<pre>$HTTP["host"] =~ "bar\.net" {
server.document-root = "/home/sites/bar.net/http"
accesslog.filename         = "/home/sites/bar.net/logs/access.log"
}
</pre>
<p>Again, restart lighttpd</p>
<pre>/etc/init.d/lighttpd restart</pre>
<p>and you&#8217;re done.</p>
<h3>For MySQL</h3>
<p>I simply altered some of it&#8217;s fine tuning values.<br />
Open</p>
<pre>/etc/mysql/my.cnf</pre>
<p>and change the following values</p>
<pre>key_buffer              = 16K
max_allowed_packet      = 1M
thread_stack            = 64K
thread_cache_size       = 8
#max_connections        = 100
table_cache            = 4</pre>
]]></content:encoded>
			<wfw:commentRss>http://web-design-london.biz/web/lighttpdphpmysql-for-low-ram-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
