This is documentation for Kohana v2.3.x. For v3.x documentation, see http://kohanaframework.org/guide .

Table of Contents
StatusDraft
TodoContent Review and additions

Deploying Kohana to Production:

Here are a few items you should keep in mind before deploying your Kohana application to a production environment.

1. Remove the demo and example controllers

Kohana comes with various demos and example controllers to help users when getting started. Here are a few that should be removed:

2. Modify your configuration files

Kohana provides various default configuration files in the system/config directory. Since Kohana utilizes a cascading file system, you have the option to either utilize the default configuration file versions or override these files with your own custom versions by creating a copy in the application/config directory.

Modify your application/config/config.php:

Modify your index.php (in the root directory of your site):

You should always try to create custom versions of the following files:

You should also consider creating custom versions of the following files:

3. Move Kohana core directories outside of the document root

If your host does not allow this structure, use an .htaccess file to protect the core directories.

Although this is an optional step and not required by Kohana, it is considered a good security practice to place as few files as possible in your public web server document root directory. Since most web hosts give you access to at least one level above the web server document root, this should not be a problem.

Moving your core Kohana directories also gives you the ability to utilize one central Kohana codebase on your server that can be shared by multiple websites. You could also create a set of common modules used across all of your web sites.

To accomplish this in Kohana, do the following:

  1. move your Kohana system, application, and modules directories at least one level above your document root directory (typically public_html or www).
  2. modify the following lines in your index.php file:
    • $kohana_application = '../application';
    • $kohana_modules = '../modules';
    • $kohana_system = '../system';

Note: This example assumes one-level above public_html, however, you can use relative or absolute directories when specifying directory locations.

Your final directory structure will look similar to this:

   yourdomain_root_directory
   +- application
   +- system
   +- modules
   +- public_html (web server document root)
    |    - index.php
    |    - .htaccess
installation/deployment.txt · Last modified: 2011/01/16 18:15 by jordanlev