How to Setup Cherokee (Webserver) with PHP5 (FastCGI) / MySQL Support in Ubuntu 12.10
Cherokee is a cross-platform feature rich and flexible, light-weight and high-performance open source Web Server/Reverse proxy server that was released under GNU (General Public License). The Cherokee project was developed using C language and was made available for all major Operating System like Linux, Mac OS X and Windows. One of the main feature of Cherokee web server is it offers graphical admin interface from where you can manage web server related tasks.
- Powerful Web interface for managing and configuring web server.
- Easy Web application deployment.
- Support for latest web technologies like PHP, FastCGI, CGI, SSI, TLS/SSL, LDAP, HTTP proxying, Content Caching, Video Streaming etc.
- Run on Linux, Windows, MacOS X and BSD
This article shows how to install Cherokee (Web server) on Ubuntu 12.10 Server with PHP5 (FastCGI) / MySQL Support. This article also supports older version of Ubuntu. Make sure you must be logged as root user to perform all tasks mentioned in this article.
Installing MySQL in Ubuntu 12.10
First, install MySQL support for Cherokee web server. In the middle of installation, it will be asked you to supply new MySQL root user password.
# apt-get install mysql-server mysql-client
Installing PHP5 with FastCGI in Ubuntu 12.10
Next, install PHP5 with FastCGI support for Cherokee web-server.
# apt-get install php5 php5-cgi
Configuring PHP5 for FastCGI Support
To get fastcgi support, open the file /etc/php5/cgi/php.ini.
# nano /etc/php5/cgi/php.ini
And uncomment the line cgi.fix_pathinfo=1: and save the file. See the screenshot below.
Installing Cherokee Web Server In Ubuntu 12.10
We use Cherokee own PPA (Personal Package Archive) repository, so lets add the ppa to your system and do the system update.
# add-apt-repository ppa:cherokee-webserver/ppa # apt-get update
Once, PPA added, Open terminal with “Ctrl+Alt+T” and type command from terminal. It will ask confirmation whether you want to install Cherokee Web Server. Type ‘Yes’ to continue.
# apt-get install cheroke
One of the nice features of Cherokee Web Server of it’s Web based admin control panel from where you can manage your Web Server. Fire command ‘cherokee-admin’ it will launch one time username and password which will be use later on (Please copy password in clipboard). By default Cherokee Web Server is bind to local host (127.0.0.1) or system IP Address (xx.xx.xx.xx) at port no 9090. In my case it would be something like http://10.0.2.15:9090/.
Now, Open browser and type http://127.0.0.1:9090/ or http://10.0.2.15:9090/ in address bar. When prompted supply username ‘admin‘ paste password which was copied earlier during ‘cherokee-admin’ command. This is how web interface looks like and running of Cherokee Web Server.
How to Start, Stop and check the status of Cherokee Web Server. Also to verify cherokee-admin and Web Server are running.
# /etc/init.d/cherokee status # /etc/init.d/cherokee stop # /etc/init.d/cherokee start # /etc/init.d/cherokee restart
sudo netstat -antp | grep cherokee
To stop running cherokee-admin, press CTRL+C on the terminal or use the following command.
sudo killall -TERM cherokee-admin
Configuring PHP5 with FastCGI Support for Cherokee
By default PHP5 support is not enabled in Cherokee. We need to enable it manually by going to Cherokee’s admin control panel at http://10.0.2.15:9090/.
Navigate to vServers, select the default vhost and then go to Behavior tab and run the Rule Management.
At the left column, you will see list of available rules. See the picture below for you reference.
Click on the “+” icon next to Behavior tab that says “Add Behaviour Rule“.
Select “Languages” from the left column, then choose PHP and hit “Add” button.
Next, click on the Create button in the Configuration Assistant window.
A new rule added to left column that says “Extensions php” with status “NON FINAL“. Click on “NON FINAL” and make it as “FINAL“.
Next, at top right corner, you will see “SAVE” button, click on that to save settings.
Now restart the Cherokee web server to take new changes.
# /etc/init.d/cherokee restart
Next, go to vServers, under Behavior tab, you will see PHP is enabled.
Testing PHP5 with FastCGI Support
The default web root directory for web site is /var/www. Under this directory create a file called phpinfo.php.
# nano /var/www/phpinfo.php
Add the following lines of code it and save the file.
<?php phpinfo(); ?>
Next, call the file in the browser as http://10.0.2.15/phpinfo.php
See the above figure, you will see PHP5 is enabled with FastCGI support with other per-loaded modules, but one thing is missing from the list (i.e. MySQL). We haven’t yet added the support for MySQL for PHP5. Let’s do it.
Enabling MySQL Support for PHP5
To enable MySQL support for PHP, install php5-mysql package with other important php modules that might required for your applications.
# apt-get install php5-mysql php5-gd php5-curl php-pear php5-imagick php5-memcache php5-xmlrpc php5-xsl
Next, restart the Cherokee web server.
# /etc/init.d/cherokee restart
Refresh the browser (http://10.0.2.15/phpinfo.php) and search for the “mysql“, you will get a MySQL section with list of other modules.
Thats It! For more information, please visit at Cherokee Web Server.