Description: Cherokee is a flexible, very fast, lightweight Web server. It is implemented entirely in C, and has no dependencies beyond a standard C library. It is embeddable and extensible with plug-ins. It supports on-the-fly configuration by reading files or strings, TLS/SSL (via GNUTLS or OpenSSL), virtual hosts, authentication, cache friendly features, PHP, custom error management, and much more.
Keywords: cherokee web server httpd http

## Index → Cookbook

## Cookbook: Setting up Joomla

Setting up Joomla with Cherokee is really easy. A configuration wizard is provided that can either be used to install Joomla as a new dedicated Virtual Server, or to set it up inside a Directory.

This recipe contains three sections detailing how to: . Configure Cherokee for either installation mode using the Wizard. . Install Joomla v1.5.14 which is the last one available at the time of writing. . Configure Cherokee manually.

You don’t need to worry about the manual installation. It is legacy documentation from the time when the wizards weren’t available. Every step described there is taken care of by the wizard.

### Configure Cherokee using the Wizard

Two common scenarios are contemplated: installation on a dedicated virtual server (http://joomla.example.net/, for instance) or under a subdirectory on an existing virtual server (as could be http://example.net/joomla/).

#### Setting up Joomla as a new Virtual Server

The first step would be visiting the virtual server list page and clicking on the `Add` button at the top of the panel to show the list of available wizards.

Now, you will have to select the `CMS` category, and run the Joomla wizard. At this stage the Joomla wizard will ask you for some basic parameters about the installation. It will try to auto-fill as many entries of the form as possible. For instance, if it finds Joomla installed in a standard location it will use that path as the default directory.

The new virtual server will be created after this form is submitted. The virtual server configuration will cover the vast majority of the cases. Most probably it will cover your needs, although you are free to modify it as you will.

#### Setting up Joomla inside a Directory

Joomla can also be configured inside a directory. Let’s suppose we want to set up Joomla inside the `/blog` directory of one of our virtual servers.

In this case, the first thing you will have to do is to enter the virtual server configuration you’d like to configure Joomla in. Once in there, visit the `Behavior` tab and trigger the `Rule panel` by clicking on the `Rule Management` button. Then, use the `Add` button at the top of the panel to see the available wizards:

As in the previous case, this wizard will ask some very basic information, including the public web directory where Joomla will be set up and the local Joomla source directory.

### Installing Joomla

Once Cherokee is ready, only the database issue remains to be able to install Joomla. Log in to MySQL:

    mysql -u root -p

And create the database for Joomla. We will be using the name joomla, the user joomlauser and the password joomlapassword, but you should set up your own.

    CREATE DATABASE joomla;
    GRANT ALL PRIVILEGES ON joomla.* TO joomlauser@localhost IDENTIFIED BY 'joomlapassword';
    GRANT ALL PRIVILEGES ON joomla.* TO joomlauser@localhost.localdomain IDENTIFIED BY 'joomlapassword';
    FLUSH PRIVILEGES;
    quit;

Then point your web browser to `http://localhost/joomla` and follow the instructions provided by the Joomla installer.

There is not much else you must do for Cherokee to work with Joomla. If you follow the Joomla installer’s instructions -providing valid database information in most cases will suffice-, you will go thorough every step swiftly. Once you are done you will have to eliminate the `installation` subdirectory, as Joomla does not allow going any further until you do so as a security precaution. It is also a good idea to make the `cache` directory world writable.

    rm -rf /var/www/joomla/installation
    chmod 777 /var/www/joomla/cache

Now to set up Joomla. Visit http://localhost/administration and log in. Go to the `Global Configuration` option and enable all the SEO Settings, including the ones for Apache mod_rewrite.

Mission accomplished. You can skip the rest of the document unless you want some more insight on what exactly has been done by the Cherokee-Admin Joomla Wizard.

### Configuring Cherokee manually

The wizard handles both series of Joomla, 1.5.x and 1.6.x. This manual process was documented for 1.5.x and does not work for 1.6.x.

You will need PHP support correctly configured in Cherokee, and PHP with the MySQL module installed. For this you will require php-cgi installed on your system, and to run the PHP wizard, so in case it is not configured yet you an follow the appropriate recipe about setting up PHP. You will also need an FTP server if the Joomla files are owned by a user other than the one running the web server.

Under these conditions, you could start Joomla’s installation and you would already be able to have your site up and running.

However, we can add several refinements. In this recipe we will be dedicating a virtual server entirely to Joomla, so either create a new one or adjust `default` accordingly. Of course, you can also set it up under a directory in an existing virtual server, but we will take the first approach for clarity and simplicity.

For our purposes, we will make the modifications in our `default` virtual server. This will only affect the URLs we’ll be accessing to log in to Joomla. First download and uncompress the distributed Joomla release into `/var/www/joomla`, and set that path as the `Document Root` in your virtual host’s `Basics` tab.

We will also be making changes in the `Error Handler` tab, selecting the `Custom redirections` option and adding an option to send errors to Joomla.

Error | URL
--- | ---
403 Forbidden | /index.php
404 Not Found | /index.php

Finally, set up the rewrite rules recommended by Joomla to block out the most common type of exploit attempts. To do so, simply create `Regular Expression` rules for the following expressions:

    mosConfig_[a-zA-Z_]{1,21}(=|\%3D)
    base64_encode.*\(.*\)
    (\<|%3C).*script.*(\>|%3E)
    GLOBALS(=|\[|\%[0-9A-Z]{0,2})
    _REQUEST(=|\[|\%[0-9A-Z]{0,2})

Each should be managed by a handler that returns an error:

Handler | Error
--- | ---
HTTP error | 403 Forbidden

After this you are done! Remember that all these settings are refinements not really needed by Joomla to perform its basic functions.