{ Josh Rendek }

<3 Go & Kubernetes

After getting my new mac book pro I had an extra laptop sitting around… 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

gunzip lighttpd-1.4.20.tar.gz

tar -xvf lighttpd-1.4.20.tar

cd lighttpd-1.4.20

./configure 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.

Install MySQL:

Everything went okay so now onto Ruby

First lets get PHP working with Lighty.



Lets change the document root to be /home/dev/

Lets also make sure we change the user of Lighty:

change uid to (default: don’t care)

server.groupname = “dev” Now scroll down and add this to the bottom:

Lets try starting Lighty:

Now lets see if PHP worked…. browse to your dev server’s ip and you should see the php info page, and all is well.

Now lets get Ruby working Now lets get Ruby-FCGI

“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 –param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -Wall -fno-strict-aliasing -fPIC conftest.c -o conftest.i” conftest.c:1:21: error: fcgiapp.h: No such file or directory checked program was: /* begin / 1: #include / end */

have_header: checking for fastcgi/fcgiapp.h… ——————– no

“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 –param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -Wall -fno-strict-aliasing -fPIC conftest.c -o conftest.i” conftest.c:1:29: error: fastcgi/fcgiapp.h: No such file or directory checked program was: /* begin / 1: #include / end */

——————– Fix:

Now install gem: wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz

Gunzip, tar -xvf it and then compile it:

run ruby setup.rb

That should install Gem for you.

Next you need to install Rails, which can be done very easily now

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.

First: start a project

That creates your first demo project.

Now lets make a controller:

Start the development server:

Browse to http://yourserverip:3000/hello Error: MissingSourceFile in HelloController#index

no such file to load – sqlite3

RAILS_ROOT: /home/ruby/demo

To fix:

Hit Ctrl+C to stop the web daemon, then:

Change it to read something like:

Now to install Ruby MySQL:

Now try running the server again

and browse to http://yourserverip:3000/hello and you should get another error: Unknown action

No action responded to index. Actions:

To fix, first exit the web server (Ctrl+C), then:

Save and exit, and then:

Browse to http://yourserverip:3000/hello

And voila, Rails! You should see: “Hello World!”

I did however find a simpler way to run this using Mongrel:

Now to setup a Python (via Django)

cd /home/ mkdir python cd python django-admin.py startproject demo cd demo python manage.py runserver

Browsing to http://yourserverip:8000/ you should see:

It worked! Congratulations on your first Django-powered page.

You’re now all set up with one server that can serve PHP, Python, and Ruby pages.

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.

Please leave a comment if you spot a bug / error somewhere!

comments powered by Disqus