Cheap VPS & Xen Server


Residential Proxy Network - Hourly & Monthly Packages

How To Install And Configure Cherokee Web Server With PHP 5 And MySQL 5 Support On Ubuntu 8.10 Server (Intrepid Ibex)


From http://www.cherokee-project.com/:
“Cherokee is a very fast, flexible and easy to configure Web Server. It supports the widespread technologies nowadays: FastCGI, SCGI, PHP, CGI, TLS and SSL encrypted connections, Virtual hosts, Authentication, on the fly encoding, Load balancing, Apache compatible log files, and much more.”

This tutorial shows how to install Cherokee from source with PHP and MySQL support on a Ubuntu 8.10 server machine. The reason for compiling from source instead of using apt to install binary packages is that there are older versions in the repositories than the ones available on Cherokee’s homepage. The main goal is to install the webserver so I didn’t bother compiling everything else. That way you won’t spend to much time on doing things I didn’t want to describe. I do not issue any guarantee that this will work for you!

1) Preliminary note

I’m using a Ubuntu 8.10 server system installed according to steps 1-3, 5, 7 and 8 described in that howto: http://www.Kreationnext.com/perfect-server-ubuntu-8.10. I also use the expression “serveripaddress” for server’s ip address. You should replace it with your own. You should take every step of this howto logged in as root.

 

2) Install MySQL

You need a database server to run PHP scripts that use MySQL to manage data stored in user’s databases. You can install it (and the client) by entering:

apt-get install mysql-server-5.0 mysql-client

 

3) Set MySQL’s root user password

Before using MySQL a password should be set for the root user. You will be prompted for it after the server gets installed.

Remember that without setting root’s password everyone can access every database on your MySQL server.

 

4) Install PHP

PHP is a scripting language used to run scripts that can do lots of different things on the server side. You can install it like this:

apt-get install php5-cgi

PHP has an interface to MySQL server that can be installed by entering the following:

apt-get install php5-mysql

 

5) Install some needed packages

We will compile Cherokee from sources so we’ll need a C++ compiler and some other usefull packages:

apt-get install cpp gcc g++ make

 

6) Download, compile and install Cherokee web server

Download Cherokee to /tmp:

cd /tmp
wget http://www.cherokee-project.com/download/trunk/cherokee-latest-svn.tar.gz

When I wrote this text Cherokee 0.11.0b2449 was the latest snapshot version which means it’s in beta state so there still might be some errors. You could download and use a stable version from http://www.cherokee-project.com/download/ instead as well.

Unpack the downloaded archive:

tar -zxvf cherokee-latest-svn.tar.gz

and enter the new directory:

cd cherokee-0.11.0b2449

Now it has to be configured the way we need. This is the recommended way:

./configure –localstatedir=/var \
–prefix=/usr \
–sysconfdir=/etc \
–with-wwwroot=/var/www

Compile Cherokee:

make

and install it:

make install

An error like “configure:error:no acceptable c compiler found in $path” most likely means that there is no C compiler installed or it’s not in the system path. You should then make sure to install everything described in step 5 and everything will work fine.

7) Starting up Cherokee

Copy the startup script to /etc/init.d/ (don’t leave cherokee-0.11.0b2449 directory yet) and edit it:

cp contrib/cherokee /etc/init.d/cherokee
nano /etc/init.d/cherokee

and change two paths in lines starting with

DEAMON=

and

CONF=

like this:

DAEMON=/usr/sbin/cherokee
CONF=/etc/cherokee/cherokee.conf

Press CTRL+X and Y to write and close the file.
Give appropriate access permissions to the script:

chmod 755 /etc/init.d/cherokee

Check if Cherokee can start by entering:

/etc/init.d/cherokee start

Make startup links in different runlevels:

update-rc.d cherokee defaults

Everything should work correctly by now. You can test php and its modules by making a file named for example info.php and putting it in document_root of the server. It should contain

<? phpinfo(); ?>

Next open this file in a web browser:

http://serveripaddress/info.php

Just to be sure you can reboot and see if Cherokee is started automatically.

 

8) Configure the server

This is what makes Cherokee special. There are a number of ways of configuring it. It can be done in a traditional way by editing configuration files but in this case it is not recommended. It can also be done using a web interface called cherokee-admin. This part gave me a little headache when I tried to make it work on Debian Etch. However there were no problems with it on Ubuntu. By default cherokee-admin is accessible only from the server. After you start it by hand it will generate a one time password, show it to you and bind on localhost on port 9090. To access it you would have to open http://localhost:9090 in a browser working on the server. Since installing a graphical interface on a server is also not recommended (you can use a text browser but that wouldn’t make the configuration easy) you have to find a way to reach cherokee-admin from a remote client. Here’s how you can do it (pick your favorite): (be sure to also check whether there are any firewall rules blocking port 9090 and/or is it free)

 

Making an SSH tunnel

This will make a tunnel that will forward port 9090 to a client computer. In effect you should be able to connect to the cherokee-admin web interface by browsing to: http://127.0.0.1:9090. All you have to do is open a terminal and connect to the server using SSH:

ssh root@serveripaddress

After logging in start cherokee-admin:

cherokee-admin

You will see some general info about the application, username and one time password that will be used to log into the web interface. Write it down or just copy. Now open a new terminal window and connect to the server again like so:

ssh -L 9090:127.0.0.1:9090 root@serveripaddress

and enter your password. Now the tunnel is active and you can open http://127.0.0.1:9090 in a browser.

Sometimes Firefox 3 may complain that the port is not standard and not used for browsing web sites and it will refuse to connect (it happens in some cases). That is strictly Firefox’s fault. If everything goes well cherokee-admin should ask you for that username and one time password you’ve copied earlier. Then the web interface should open.

Notes:
-the tunnel will remain active until you close the connection initiated by SSH -L ……; the connection can be closed by the server in case of no activity; it doesn’t matter that you will use cherokee-admin, you should also keep the connection alive by typing for example: ls from time to time (it doesn’t matter what, just do something); that depends on your SSH server settings.
-if you are using Putty on Windows as a client you can still make SSH tunnels; take a look here to find out how: http://oldsite.precedence.co.uk/nc/putty.html.

 

Binding cherokee-admin to all interfaces

The other way of dealing with configuration of Cherokee is unbinding cherokee-admin from localhost:9090 and connecting to it directly. To do it connect to the server by ssh:

ssh root@serveripaddress

and enter:

cherokee-admin -b

Then open your browser and connect to:

http://serveripaddress:9090

cherokee-admin should then ask for username and one time password. After finishing the configuration, save it and restart Cherokee. You should also end cherokee-admin process for security reasons. Here are some screenshots of cherokee-admin in action:

1

2

3

– Ubuntu: http://www.ubuntu.com
– Cherokee: http://www.cherokee-project.com/

Comments

comments