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 WordPress

Setting up WordPress with Cherokee is really easy. This recipe describes the WordPress 2.8.x installation, which is the latest release at the time of writing.

There is a screencast available at the Cherokee-Project website to demonstrate how easy it is to use the WordPress wizard.

There are two ways of installing WordPress: it can either be installed as a new virtual server or be installed inside a directory of some of the virtual servers that already exist.

### Setting up WordPress as a new Virtual Server

The first step would be to go to the virtual server list page. Once in there, click 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 WordPress wizard. At this stage the WordPress 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 WordPress 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 WordPress inside a Directory

WordPress can also be configured inside a directory. Let’s suppose we want to set up WordPress 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 WordPress in. Visit the `Behavior` tab, use the `Rule Management` button and click on the `Add` button at the top of the panel.

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

#### WARNING

Beware of the long time it gets WordPress to get through the installation. It has been known to exceed the timeout that Cherokee uses as default, and while this will still sometimes allow for a complete installation, it will most probably cause a failure while delivering the last page of the process. Since this is the page that provides the random password needed to access the admin page of WordPress, you installation will be useless.

If you encounter this problem, please increase your server’s `timeout` value, under the `Basic Behavior` paragraph of the `General` tab, and start over.

If you are going to attempt to make an installation as is, with no reconfiguration of Cherokee whatsoever, you can skip right to the section Setting up WordPress.

#### WARNING

Beware of another possible break point. The last step in the installation of WordPress involves mailing the details of the new account to the provided email. Normally the process will be painless: if the system is running an MTA, this report will be sent. If not, it will simply skip this step. In both cases the information will also be displayed on screen. However, there is a corner case that might make your installation fail: if the server is running a broken MTA, this could make PHP fail when trying to deliver the email, in turn resulting in a failure during the installation, and making Cherokee report an `Error 500`. Having a broken MTA on a production server is a very unlikely scenario, but double check your MTA in case you receive this error.

### Setting up WordPress

First download and uncompress the distributed WordPress release into `/var/www/wordpress`, and create a database suitable for the installation.

Log in to MySQL:

    mysql -u root -p

And create the database for WordPress. We will be using the name wp, the user wpuser and the password wppassword, but you should set up your own.

    CREATE DATABASE wp;
    GRANT ALL PRIVILEGES ON wp.* TO wpuser@localhost IDENTIFIED BY 'wppassword';
    GRANT ALL PRIVILEGES ON wp.* TO wpuser@localhost.localdomain IDENTIFIED BY 'wppassword';
    FLUSH PRIVILEGES;
    quit;

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

And the installation will be automatic. Just fill up the requested values and you will obtain the following results once your are through.

With that, you are done installing. Let’s log in and make the last adjustments.

Once we’re logged, we can configure the way `permalinks` are displayed. Just use the `Settings`→`Permalinks` menu, and adjust the way the links are to be rewritten.

Remember to set up the plugins that are of interest for you, such as the sitemap generator, in a fashion compatible with what you configured in Cherokee.

And voilà! You have a WordPress installation working flawlessly with Cherokee.