How To Install And Configure Cherokee Web Server With PHP 5 And MySQL 5 Support On Ubuntu 8.10 Server (Intrepid Ibex) - Page 2
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
and change two paths in lines starting with
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:
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:
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:
After logging in start 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.
-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:
Then open your browser and connect to:
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: