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 SugarCRM

For this recipe we will be using Sugar Community Edition 5.5, which is the latest freely distributable edition available at the download site when this was written.

The `Full installation package` will be enough. No need to use the bulky complete stacks. We just need PHP support correctly configured in Cherokee, and PHP with the MySQL module installed. The default configuration already provides a valid PHP configuration for Cherokee if you have php-cgi installed, but you can follow the appropriate recipe about setting up PHP in case you don’t have it available for any reason.

### Adjusting Cherokee

You can either read through this whole section to install it manually, or you can follow the recommended method and use the provided installation Wizard.

To do this, you’ll have to locate the Wizard, available for installation under a subdirectory or using a new dedicated virtual server. In both cases you’ll find a Wizard option: For the former you’ll have to access the Wizard from the list of available ones within the `Virtual Servers` section of Cherokee-Admin, clicking on the `Add` button at the top of the panel. The latter is accessed through the same list of Wizards, this time using the `Rule Management` button within the `Behavior` tab of any given virtual server. Once the panel with the rules is listed, follow a similar procedure using the `Add` button located at the top.

Once the Wizard list is visible, simply go to the `Misc` section, click on `Sugar`, provide the basic information and you can skip the rest of this section and jump directly to Package installation

If you choose not to follow the recommended method, you’ll just have to go through these steps:

First, create the directory that will be used when installing SugarCRM.

    # mkdir /var/www/sugar

Then launch Cherokee-Admin on your system, and set the created path as `Document web root` of your `default` virtual server. This is done through the `Basics` tab of the mentioned virtual server.

The only other thing to do with Cherokee is recreate the SugarCRM restrictions coded in the `.htaccess` file. Those are mere redirections put in place to avoid users from accessing certain files. If it is not yet populated, it will after the installation. You should check it out to account for cases not covered in the following rules.

We will have to create several rules in our virtual server to cover the whole list of banned files. This list is loosely based on the one provided by `.htaccess`.

Type | Regular Expression | Substitution
--- | --- | ---
Internal | ^/(.*\.log.*|not_imported_.*txt) | /log_file_restricted.html
External | emailmandelivery.php | /index.php
External | ^/.*/.*\.php | /index.php

These need to be created as `Regular Expression` type rules matching the expressions of the list. The rules must be managed by the `Redirection` handler, and you will need to specify only the type and substitution to perform. The regular expression is inherited, so no need to re-type it.

Of course you can also add as many rewriting rules as you wish to beautify your URLs, but those will have to be analyzed on an individual base.

### Package installation

Uncompress SugarCRM to your web document root and rename the directory to whatever you like. We will choose `/var/www/sugar` as installation directory for this recipe.

Then remember setting up file permissions. Some files and directories need to be writable by the user that runs Cherokee. Those are:

- cache

- custom

- data

- modules

- config.php

By simply accessing the configured virtual host, the installer will start. Since we have modified our `default` virtualhost, we can access visiting `http://localhost`.

Commencing installation

You’ll need to Accept the license agreement before you can go on, and once you’ve done this the installer will run the compatibility checks.

Select `Typical` installation, choose the MySQL database, fill in the required data and if everything went smoothly, the installer should create the database and go through with the whole process.

Here is where you will see which requirements are not met. Most probably you will have to make some minor adjustments.

In this case we had to modify some values in the `php.ini` file to provide higher memory limits and allow bigger files to be uploaded. Remember that it is likely you will have several of those in your system, each one for its own PHP: the CGI version, the CLI, etc. Cherokee uses PHP through FastCGI, so edit that one with your favorite editor.

Editing the PHP configuration

    # editor /etc/php5/cgi/php.ini

memory_limit = 40M

upload_max_filesize = 8M

To see the changes reflected in the installer you would have to respawn the php instances. Simply kill them and Cherokee will do the rest.

If something is still not supported, it will prompt you so you can change it before you proceed.

Warnings

For this example we will not be needing `IMAP`, so we will disregard the warning. After proceeding with the process we should be presented with the login page.

Login
Working