<?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>BlueScripts &#187; lighttpd</title>
	<atom:link href="http://bluescripts.net/tag/lighttpd/feed/" rel="self" type="application/rss+xml" />
	<link>http://bluescripts.net</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Wed, 07 Jul 2010 16:42:05 +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>Lighttpd + mod_magnet on CentOS (64 bit)</title>
		<link>http://bluescripts.net/2009/08/lighttpd-mod_magnet-on-centos-64-bit/</link>
		<comments>http://bluescripts.net/2009/08/lighttpd-mod_magnet-on-centos-64-bit/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 15:20:17 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[64bit]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[lua]]></category>
		<category><![CDATA[mod_magnet]]></category>

		<guid isPermaLink="false">http://bluescripts.net/?p=238</guid>
		<description><![CDATA[After about an hour of tinkering around on google and in the terminal here is what you need to do: wget http://www.lua.org/ftp/lua-5.1.2.tar.gz tar xfz lua-5.1.2.tar.gz cd lua-5.1.2 nano src/Makefile Replace: CFLAGS= -O2 -Wall $(MYCFLAGS) With: CFLAGS= -O2 -Wall -fPIC $(MYCFLAGS) make linux install wget http://luaforge.net/frs/download.php/2384/md5-1.0.2.tar.gz tar xfz md5-1.0.2.tar.gz cd md5-1.0.2 make make install cd .. [...]]]></description>
			<content:encoded><![CDATA[<p>After about an hour of tinkering around on google and in the terminal here is what you need to do:</p>
<pre>
wget http://www.lua.org/ftp/lua-5.1.2.tar.gz
tar xfz lua-5.1.2.tar.gz
cd lua-5.1.2
nano src/Makefile
</pre>
<p>Replace:</p>
<pre> CFLAGS= -O2 -Wall $(MYCFLAGS) </pre>
<p>With:</p>
<pre> CFLAGS= -O2 -Wall -fPIC $(MYCFLAGS) </pre>
<pre>
make linux install

wget http://luaforge.net/frs/download.php/2384/md5-1.0.2.tar.gz
tar xfz md5-1.0.2.tar.gz
cd md5-1.0.2
make
make install
cd ..
wget http://luaforge.net/frs/download.php/1678/luazlib-0.0.1.rar

wget wget http://www.rarlab.com/rar/unrar-3.7.7-centos.gz
gunzip unrar-3.7.7-centos.gz
chmod +x unrar-3.7.7-centos
./unrar-3.7.7-centos x luazlib-0.0.1.rar
cd luazlib-0.0.1
make
make install

export LUA_CFLAGS="-I/usr/local/include"
export LUA_LIBS="-L/usr/local/lib -llua"

cd LIGHTTPD_DIRECTORY
./configure -with-lua
make
make install
</pre>
<p>All done!</p>
<p>Thanks to:<br />
<a href="http://gadelkareem.com/2007/09/17/dynamic-content-caching-using-lighty-mod_magnet-lua/">http://gadelkareem.com/2007/09/17/dynamic-content-caching-using-lighty-mod_magnet-lua/</a> &#038;&#038; <a href="http://www.verlihub-project.org/doku.phpid=howto_install_lua_library_on_64_bit">http://www.verlihub-project.org/doku.phpid=howto_install_lua_library_on_64_bit</a></p>
]]></content:encoded>
			<wfw:commentRss>http://bluescripts.net/2009/08/lighttpd-mod_magnet-on-centos-64-bit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lighttpd, Mongrel, Ruby on Rails, and Lighttpd Proxy backend Performance Comparison</title>
		<link>http://bluescripts.net/2009/03/lighttpd-mongrel-ruby-on-rails-and-lighttpd-proxy-backend-performance-comparison/</link>
		<comments>http://bluescripts.net/2009/03/lighttpd-mongrel-ruby-on-rails-and-lighttpd-proxy-backend-performance-comparison/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 01:37:27 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[research]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[apache passenger]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[mod_rails]]></category>
		<category><![CDATA[mongrel]]></category>
		<category><![CDATA[performance lighttpd]]></category>
		<category><![CDATA[phusion]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://bluescripts.net/?p=188</guid>
		<description><![CDATA[First I was kind of surprised at the lack of performance comparisons people have made between the different lighttpd proxies with a rails/mongrel cluster backend and which ones would be best. Lets start off the the specs of the box: Intel Atom 330 CPU Standard 7,200RPM HDD CentOS 5.2 2GB Ram Lighttpd with 3 Mongrel [...]]]></description>
			<content:encoded><![CDATA[<p>First I was kind of surprised at the lack of performance comparisons people have made between the different lighttpd proxies with a rails/mongrel cluster backend and which ones would be best.</p>
<p>Lets start off the the specs of the box:<br />
Intel Atom 330 CPU<br />
Standard 7,200RPM HDD<br />
CentOS 5.2<br />
2GB Ram<br />
Lighttpd with 3 Mongrel Clusters running an online food ordering system I wrote (MySQL + Rails)</p>
<p>Other than that there was nothing special. I&#8217;ve done no kernel tweaking or any other performance optimizations with Lighttpd or any other part of the system.</p>
<p>Result Data	/ Proxy Type /	Result</p>
<h2>Requests Per Second</h2>
<p><a href="http://bluescripts.net/wp-content/uploads/2009/03/requests-per-second.png"><img class="alignnone size-full wp-image-189" title="requests-per-second lighttpd rails mongrel cluster" src="http://bluescripts.net/wp-content/uploads/2009/03/requests-per-second.png" alt="requests-per-second lighttpd rails mongrel cluster" width="451" height="271" /></a></p>
<p>Hash	       21.41<br />
Round-Robin	39.73<br />
First	40.07</p>
<p>Hash is the loser in the proxy test over all. The requests per second capabilities of it were nearly half of what Round-Robin and First were able to achieve with the 3 node mongrel cluster running in the background. This is to be expected though since the Hash algorithm (so far as I understand it) will send the same url requests to the same proxy to help caching, whereas round-robin and first proxy methods balance it over the 3 nodes (or however many you have running).</p>
<h2>Total Time Taken</h2>
<p><a href="http://bluescripts.net/wp-content/uploads/2009/03/time-taken.png"><img class="alignnone size-full wp-image-190" title="time-taken" src="http://bluescripts.net/wp-content/uploads/2009/03/time-taken.png" alt="time-taken" width="451" height="271" /></a></p>
<p>Hash 	467.20772<br />
Round-Robin	251.725273<br />
First	249.578092</p>
<p>Round-Robin are nearly neck and neck with the total time taken to return 10,000 hits with 250 concurrency, while the hash algorithm still lags far behind.</p>
<h2>Transfer Rate</h2>
<p><a href="http://bluescripts.net/wp-content/uploads/2009/03/transfer-rate.png"><img class="alignnone size-full wp-image-191" title="transfer-rate" src="http://bluescripts.net/wp-content/uploads/2009/03/transfer-rate.png" alt="transfer-rate" width="451" height="271" /></a></p>
<p>Hash 	59.74<br />
Round-Robin	110.84<br />
First	111.79</p>
<p>Since only one mongrel cluster is able to serve all the requests in Hash, where as 3 are able to in the Round Robin and First tests, the transfer rate is much higher. I&#8217;m sure this could have been improved even further had I put all static files like style sheets and images on a separate instance so Mongrel could just worry about the rails files instead of rails + static, but since this site only has about 5 or so images, I did not think it necessary.</p>
<h2>Longest Request</h2>
<p><a href="http://bluescripts.net/wp-content/uploads/2009/03/longest-request.png"><img class="alignnone size-full wp-image-192" title="longest-request" src="http://bluescripts.net/wp-content/uploads/2009/03/longest-request.png" alt="longest-request" width="451" height="271" /></a></p>
<p>Hash 	22795<br />
Round-Robin	17132<br />
First	11936</p>
<p>This is the result data where First comes through, beating Round Robin by a good portion (~6 seconds) and proving to be the quickest to serve up the website.</p>
<h2>Load Averages</h2>
<p><a href="http://bluescripts.net/wp-content/uploads/2009/03/load-avg.png"><img class="alignnone size-full wp-image-193" title="load-avg" src="http://bluescripts.net/wp-content/uploads/2009/03/load-avg.png" alt="load-avg" width="451" height="271" /></a></p>
<p>Hash 	1.15<br />
Round-Robin	3.15<br />
First	3.28</p>
<p>Since Hash is only using one mongrel cluster instance, instead of the 3, the CPU load was much lower. However, Round Robin and First were very close, but I believe that when comparing the request times for First and Round Robin, First is worth the <em>very</em> miniscule increase in server load.</p>
<h3>Notes on Apache + Passenger + Mod_Rails + Phusion mumbo jumbo</h3>
<p>I&#8217;m not going to claim to be an Apache expert, but one thing I&#8217;m positive about is Apache&#8217;s slowness&#8230;. with everything. I go nuts when pages don&#8217;t load fast because of server software and when I tried out Phusion Passenger / Mod Rails and apache (whatever you want to call it)&#8230; even with Enterprise ruby installed, it was still incredibly slow (noticable to me while just randomly hitting refresh).</p>
<p>While Phusion makes deploying rails apps a bit simpler / easier to add new apps, in the long run I view it as detrimental should your application ever grow. The reason I chose to work with mongrel and Lighttpd (although Nginx is another viable option) is because I looked at sites like GitHub and EngineYard (a large rails host) and checked a few of their web server headers and found them to be running Nginx (with a Mongrel backend I&#8217;m assuming).</p>
<p>If you&#8217;re worried about memory I did not notice much of a difference between what my application used while in Phusion vs Mongrel, but one of the <span style="text-decoration: underline;"><strong>HUGE</strong></span> differences I did notice was when running `ab -n 1000 -c 10` the load would shoot up to 5, while Lighttpd&#8217;s would barely hit .89. I didn&#8217;t bother attempting `ab -n 10000 -c 250` with apache since I didn&#8217;t want the box to melt/halt/be-killed-by-apache. If load isn&#8217;t an issue and you&#8217;re a die-hard Apache fan, stick with Phusion, but my tests put it <em>way</em> behind Lighttpd+Mongrel in comparison.</p>
<p>~~~~~~~~~~~~~~~~~~~~</p>
<p>If anyone has any suggestions for other analytic&#8217;s to test let me know! I&#8217;d love to do some more research regarding this and post my findings since there seems to be a lack of them on google.</p>
<p><strong>Proxy: Hash Raw Data</strong></p>
<pre>
Server Port:            80

Document Path:          /
Document Length:        2495 bytes

Concurrency Level:      250
Time taken for tests:   467.20772 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      28570261 bytes
HTML transferred:       24950000 bytes
Requests per second:    21.41 [#/sec] (mean)
Time per request:       11675.520 [ms] (mean)
Time per request:       46.702 [ms] (mean, across all concurrent requests)
Transfer rate:          59.74 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   3.2      0      35
Processing:    72 11547 1056.2  11694   22795
Waiting:       72 11547 1056.2  11694   22795
Total:         72 11548 1055.2  11694   22795

Percentage of the requests served within a certain time (ms)
  50%  11694
  66%  11717
  75%  11739
  80%  11794
  90%  11887
  95%  11907
  98%  11928
  99%  11942
 100%  22795 (longest request)
</pre>
<p><strong>Proxy Type: Round Robin Raw Data</strong></p>
<pre>
Server Port:            80

Document Path:          /
Document Length:        2495 bytes

Concurrency Level:      250
Time taken for tests:   251.725273 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      28570213 bytes
HTML transferred:       24950000 bytes
Requests per second:    39.73 [#/sec] (mean)
Time per request:       6293.132 [ms] (mean)
Time per request:       25.173 [ms] (mean, across all concurrent requests)
Transfer rate:          110.84 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   3.2      0      37
Processing:   103 6192 2439.0   6653   17132
Waiting:      103 6192 2439.0   6653   17132
Total:        103 6192 2438.5   6653   17132

Percentage of the requests served within a certain time (ms)
  50%   6653
  66%   7665
  75%   8169
  80%   8495
  90%   9038
  95%  10066
  98%  10377
  99%  10468
 100%  17132 (longest request)
</pre>
<p><strong>Proxy Type: First Raw Data</strong></p>
<pre>
--- Proxy: First 3.28 ---
Server Port:            80

Document Path:          /
Document Length:        2495 bytes

Concurrency Level:      250
Time taken for tests:   249.578092 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      28570190 bytes
HTML transferred:       24950000 bytes
Requests per second:    40.07 [#/sec] (mean)
Time per request:       6239.453 [ms] (mean)
Time per request:       24.958 [ms] (mean, across all concurrent requests)
Transfer rate:          111.79 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   3.3      0      37
Processing:   307 6169 621.6   6256   11936
Waiting:      306 6168 621.7   6256   11936
Total:        307 6169 620.0   6256   11936

Percentage of the requests served within a certain time (ms)
  50%   6256
  66%   6450
  75%   6550
  80%   6598
  90%   6734
  95%   6795
  98%   6858
  99%   6897
 100%  11936 (longest request)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://bluescripts.net/2009/03/lighttpd-mongrel-ruby-on-rails-and-lighttpd-proxy-backend-performance-comparison/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Setting up a Development Machine With PHP, Lighty, Ruby, and Python</title>
		<link>http://bluescripts.net/2009/02/setting-up-a-development-machine-with-php-lighty-ruby-and-python/</link>
		<comments>http://bluescripts.net/2009/02/setting-up-a-development-machine-with-php-lighty-ruby-and-python/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 16:13:42 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[tutorials]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://bluescripts.net/?p=144</guid>
		<description><![CDATA[After getting my new mac book pro I had an extra laptop sitting around&#8230; so why not turn it into a little low power development box My goal is to get LigHTTPD, Ruby on Rails, PHP, MySQL, and Python to work together with lighty. Step 1: Install Lighty wget http://www.lighttpd.net/download/lighttpd-1.4.20.tar.gz gunzip lighttpd-1.4.20.tar.gz tar -xvf lighttpd-1.4.20.tar [...]]]></description>
			<content:encoded><![CDATA[<p>After getting my new mac book pro I had an extra laptop sitting around&#8230; so why not turn it into a little low power development box My goal is to get LigHTTPD, Ruby on Rails, PHP, MySQL, and Python to work together with lighty.</p>
<p>Step 1: Install Lighty</p>
<div class="console">wget http://www.lighttpd.net/download/lighttpd-1.4.20.tar.gz</p>
<p>gunzip lighttpd-1.4.20.tar.gz</p>
<p>tar -xvf lighttpd-1.4.20.tar</p>
<p>cd lighttpd-1.4.20</p>
<p>./configure</p></div>
<p>Here is a list of errors / fixes encountered while doing this from a bare-bones net install. Run ./configure after each one to see what else is broken / needs to be installed.</p>
<table class="errors" border="0" cellspacing="3" cellpadding="2" width="100%">
<tbody>
<tr>
<td width="50%"><strong>Error</strong></td>
<td width="50%"><strong>Fix</strong></td>
</tr>
<tr>
<td valign="top">configure: error: no acceptable C compiler found in $PATH</td>
<td valign="top">yum install gcc</td>
</tr>
<tr>
<td valign="top">configure: error: pcre-config not found, install the pcre-devel package or build with &#8211;without-pcre</td>
<td valign="top">yum install pcre*</td>
</tr>
<tr>
<td valign="top">configure: error: zlib-headers and/or libs where not found, install them or build with &#8211;without-zlib</td>
<td valign="top">yum install zlib*</td>
</tr>
<tr>
<td valign="top">configure: error: bzip2-headers and/or libs where not found, install them or build with &#8211;without-bzip2</td>
<td valign="top">yum install bzip*</td>
</tr>
</tbody>
</table>
<p>Copy the lighttpd conf to somewhere easy to find:</p>
<div class="console">cp doc/lighttpd.conf /home/lighttpd.conf</div>
<div class="console">make<br />
make install</div>
<p>Now onto PHP:</p>
<div class="console">yum install php</div>
<p>That&#8217;s done easily enough. Verify it&#8217;s installed:</p>
<div class="console">root@localhost lighttpd-1.4.20]# php -v<br />
PHP 5.1.6 (cli) (built: Jul 16 2008 19:53:00)<br />
Copyright (c) 1997-2006 The PHP Group<br />
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies</div>
<p>Verify python&#8217;s installed:</p>
<div class="console">[root@localhost lighttpd-1.4.20]# python<br />
Python 2.4.3 (#1, May 24 2008, 13:47:28)<br />
[GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] on linux2<br />
Type &#8220;help&#8221;, &#8220;copyright&#8221;, &#8220;credits&#8221; or &#8220;license&#8221; for more information.<br />
&gt;&gt;&gt;</div>
<p>(hit ctrl+d to exit the python interpreter)</p>
<p>Install MySQL:</p>
<div class="console">yum install mysql*</div>
<p>( I just install them all as this is a dev server anyways )</p>
<p>Everything went okay so now onto Ruby</p>
<div class="console">yum install ruby*</div>
<p>Everything went okay, and all the software is installed. Now it&#8217;s time to configure them.</p>
<p><strong>First lets get PHP working with Lighty.</strong></p>
<div class="console">nano /etc/php.ini</div>
<p>hit CTRL+V to page down real quick&#8230;. at the bottom of the file add:</p>
<div class="console">cgi.fix_pathinfo = 1</div>
<p>Save the file and exit.</p>
<p>First:</p>
<div class="console">whereis php-cgi</div>
<p>It should be in /usr/bin/php-cgi</p>
<p>Second:</p>
<div class="console">adduser dev</div>
<div class="console">echo &#8221; &gt;&gt; /home/dev/index.php</div>
<p>Now lets open lighttpd.conf</p>
<div class="console">nano /home/lighttpd.conf</div>
<p>Un-comment the fastcgi, rewrite, and redirect lines.</p>
<p>Lets change the document root to be /home/dev/</p>
<p>Lets also make sure we change the user of Lighty:</p>
<div class="console">## change uid to  (default: don&#8217;t care)<br />
server.username            = &#8220;dev&#8221;</p>
<p>## change uid to  (default: don&#8217;t care)<br />
server.groupname           = &#8220;dev&#8221;</p></div>
<p>Now scroll down and add this to the bottom:</p>
<div class="console">fastcgi.server = ( &#8220;.php&#8221; =&gt; ((<br />
&#8220;bin-path&#8221; =&gt; &#8220;/usr/bin/php-cgi&#8221;,<br />
&#8220;socket&#8221; =&gt; &#8220;/tmp/php.socket&#8221;<br />
)))</div>
<p>Exit and save the file.</p>
<p>Lets try starting Lighty:</p>
<div class="console">lighttpd -f /home/lighttpd.conf<br />
2009-01-27 15:02:20: (log.c.84) opening errorlog &#8216;/var/log/lighttpd/error.log&#8217; failed: No such file or directory<br />
2009-01-27 15:02:20: (server.c.888) Opening errorlog failed. Going down.</div>
<div class="console">mkdir /var/log/lighttpd<br />
touch /var/log/lighttpd/error.log; touch /var/log/lighttpd/access.log; chown -R dev:dev /var/log/lighttpd;</div>
<p>Start lighty again and you&#8217;re all set!</p>
<p>Now lets see if PHP worked&#8230;. browse to your dev server&#8217;s ip and you should see the php info page, and all is well.</p>
<p><strong>Now lets get Ruby working</strong><br />
Now lets get Ruby-FCGI</p>
<div class="console">wget http://sugi.nemui.org/pub/ruby/fcgi/ruby-fcgi-0.8.6.tar.gz; gunzip ruby-fcgi-0.8.6.tar.gz ; tar -xvf ruby-fcgi-0.8.6.tar;<br />
cd ruby-fcgi-0.8.6<br />
ruby install.rb config</div>
<p>This fails so lets check for errors:</p>
<div class="console">[root@localhost ruby-fcgi-0.8.6]# cat ext/fcgi/mkmf.log<br />
have_header: checking for fcgiapp.h&#8230; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; no</p>
<p>&#8220;gcc -E -I. -I/usr/lib/ruby/1.8/i386-linux -I/root/tmp/ruby-fcgi-0.8.6/ext/fcgi  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector &#8211;param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -Wall -fno-strict-aliasing  -fPIC  conftest.c -o conftest.i&#8221;<br />
conftest.c:1:21: error: fcgiapp.h: No such file or directory<br />
checked program was:<br />
/* begin */<br />
1: #include<br />
/* end */</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>have_header: checking for fastcgi/fcgiapp.h&#8230; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; no</p>
<p>&#8220;gcc -E -I. -I/usr/lib/ruby/1.8/i386-linux -I/root/tmp/ruby-fcgi-0.8.6/ext/fcgi  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector &#8211;param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -Wall -fno-strict-aliasing  -fPIC  conftest.c -o conftest.i&#8221;<br />
conftest.c:1:29: error: fastcgi/fcgiapp.h: No such file or directory<br />
checked program was:<br />
/* begin */<br />
1: #include<br />
/* end */</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p></div>
<p>Fix:</p>
<div class="console">wget http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz; gunzip fcgi-2.4.0.tar.gz; tar -xvf fcgi-2.4.0.tar; cd fcgi-2.4.0<br />
./configure<br />
make<br />
make install</div>
<p>Now lets try ruby again!</p>
<div class="console">ruby install.rb config<br />
ruby install.rb setup<br />
ruby install.rb install</div>
<p>Done <img src='http://bluescripts.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>Now install gem: wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz</p>
<p>Gunzip, tar -xvf it and then compile it:</p>
<p>run
<div class="console">ruby setup.rb</div>
<p>That should install Gem for you.</p>
<p>Next you need to install Rails, which can be done very easily now</p>
<div class="console">gem install rails</div>
<p>When initially doing this I ran into an issue of Rails complaining (specifically when running the ruby script/server command) about not being able to find the specific database information. </p>
<p>First: start a project</p>
<div class="console">cd /home/<br />
mkdir ruby<br />
cd ruby<br />
rails demo
</div>
<p>That creates your first demo project.</p>
<p>Now lets make a controller:</p>
<div class="console">ruby script/generate controller hello<br />
      exists  app/controllers/<br />
      exists  app/helpers/<br />
      create  app/views/hello<br />
      exists  test/functional/<br />
      create  app/controllers/hello_controller.rb<br />
      create  test/functional/hello_controller_test.rb<br />
      create  app/helpers/hello_helper.rb
</div>
<p>Start the development server:</p>
<div class="console">ruby script/server<br />
=> Booting Mongrel (use &#8216;script/server webrick&#8217; to force WEBrick)<br />
=> Rails 2.2.2 application starting on http://0.0.0.0:3000<br />
=> Call with -d to detach<br />
=> Ctrl-C to shutdown server<br />
** Starting Mongrel listening at 0.0.0.0:3000<br />
** Starting Rails with development environment&#8230;<br />
** Rails loaded.<br />
** Loading any Rails specific GemPlugins<br />
** Signals ready.  TERM => stop.  USR2 => restart.  INT => stop (no restart).<br />
** Rails signals registered.  HUP => reload (without restart).  It might not work well.<br />
** Mongrel 1.1.5 available at 0.0.0.0:3000<br />
** Use CTRL-C to stop.
</div>
<p>Browse to http://yourserverip:3000/hello<br />
Error:<br />
 MissingSourceFile in HelloController#index</p>
<p>no such file to load &#8212; sqlite3</p>
<p>RAILS_ROOT: /home/ruby/demo</p>
<p>To fix:</p>
<p>Hit Ctrl+C to stop the web daemon, then:</p>
<div class="console">cd config<br />
nano database.yml
</div>
<p>Change it to read something like: </p>
<div class="console">development:<br />
  adapter: mysql<br />
  encoding: utf8<br />
  database: ruby<br />
  username: root<br />
  password: PASSWORD
</div>
<p>Now to install Ruby MySQL:</p>
<div class="console">
gem install mysql &#8212; \<br />
&#8211;with-mysql-include=/usr/include/mysql \<br />
&#8211;with-mysql-lib=/usr/lib64/mysql
</div>
<p>Now try running the server again</p>
<div class="console">ruby script/server</div>
<p>and browse to http://yourserverip:3000/hello and you should get another error:<br />
Unknown action</p>
<p>No action responded to index. Actions:</p>
<p>To fix, first exit the web server (Ctrl+C), then:</p>
<div class="console">cd app<br />
cd controllers<br />
nano hello_controller.rb<br />
# Change file to look like this:<br />
class HelloController < ApplicationController<br />
   def index<br />
      render :text => &#8220;Hello World&#8221;<br />
   end<br />
end
</div>
<p>Save and exit, and then:</p>
<div class="console">cd ../../;<br />
ruby script/server</div>
<p>Browse to http://yourserverip:3000/hello</p>
<p>And voila, Rails! You should see: &#8220;Hello World!&#8221;</p>
<p>I did however find a simpler way to run this using Mongrel:</p>
<div class="code">gem install mongrel</div>
<p>Wait a few for it to install and then just change to your demo directory:</p>
<div class="console">mongrel_rails start -d</div>
<p><strong>Now to setup a Python (via Django)</strong></p>
<div class="console">wget http://www.djangoproject.com/download/1.0.2/tarball/<br />
tar -xzvf Django-1.0.2-final.tar.gz<br />
cd Django-1.0.2-final<br />
python setup.py install</p>
<p>cd /home/<br />
mkdir python<br />
cd python<br />
django-admin.py startproject demo<br />
cd demo<br />
python manage.py runserver 0.0.0.0:8000
</p></div>
<p>Browsing to http://yourserverip:8000/ you should see:</p>
<p>It worked!<br />
Congratulations on your first Django-powered page.</p>
<p>You&#8217;re now all set up with one server that can serve PHP, Python, and Ruby pages.</p>
<p>This is by no means a programming tutorial, I was simply showing how to get the basics set up for people to start quickly learning PHP, Python (web programming), and Ruby on Rails.</p>
<p>Please leave a comment if you spot a bug / error somewhere!</p>
]]></content:encoded>
			<wfw:commentRss>http://bluescripts.net/2009/02/setting-up-a-development-machine-with-php-lighty-ruby-and-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
