Changeset 1755

Show
Ignore:
Timestamp:
08/06/08 20:34:36 (5 months ago)
Author:
taher
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cherokee/trunk/doc/Makefile.am

    r1752 r1755  
    9393media/images/admin_launch.png \ 
    9494media/images/tracelor.png \ 
    95 media/images/cherokee-tweak.png 
     95media/images/cherokee-tweak.png \ 
     96media/images/admin_noconfig.png \ 
     97media/images/admin_notrunning.png \ 
     98media/images/admin_rule_regex.png 
    9699 
    97100GENERATED_FILES =   \ 
  • cherokee/trunk/doc/TOC.txt

    r1752 r1755  
    2323Configuration 
    2424************************** 
    25   . Quickstart         <1>     link:config_quickstart.html[
     25  . link:config_quickstart.html[Quickstart
    2626  . link:config_general.html[General] 
    2727  . link:config_virtual_servers.html[Virtual servers] 
  • cherokee/trunk/doc/config_quickstart.txt

    r1752 r1755  
    55provided by link:bundle_cherokee-admin.html[cherokee-admin]. This is 
    66the only recommended way of configuring Cherokee. If you are looking 
    7 for development information, you should refer to the apropriate 
     7for development information, you should refer to the appropriate 
    88section, especially link:dev_cherokee.conf.html[cherokee.conf] file 
    99specification. 
     
    4848Walkthrough 
    4949~~~~~~~~~~~ 
     50There is very little set up you must do to have a perfectly functional 
     51web server out of the box. Cherokee's default configuration can be 
     52used to serve any typical PHP-driven dynamic website. 
     53 
     54If you have a specific need, you should check out the recipes present in 
     55the 'Cookbook' section of the documentation. Among other subjects, you 
     56can find information about 
     57link:cookbook_optimizing_cherokee.html[Cherokee optimizations], 
     58setting up efficient link:cookbook_authentication.html[Authentication] 
     59mechanisms, or configuring several popular application frameworks. 
     60 
     61In this tutorial we will be setting up a system with a couple of 
     62virtual servers, PHP support, some redirection rules and a simple 
     63authentication mechanism. 
     64 
     65To follow this walkthrough you need to be running 
     66link:bundle_cherokee-admin.html[cherokee-admin]. This is an 
     67administration tool, so you will need system administrator rights. 
     68 
     69---- 
     70# cherokee-admin 
     71Cherokee Web Server 0.8.0 (Aug  6 2008): Listening on port 9090, TLS disabled, 
     72IPv6 disabled, using epoll, 1024 fds system limit, max. 507 connections, 
     73single thread, 1016 fds 
     74Server 0.8.0 running.. PID=19611 
     75---- 
     76 
     77Now you can access the administration interface simply by opening your 
     78web browser and visiting link:http://localhost:9090[http://localhost:9090] 
     79 
     80If your user doesn't have enough privileges you will be notified. Also 
     81if no configuration file exists you will be prompted to create one 
     82with the default settings. 
     83 
     84image::media/images/admin_noconfig.png[cherokee.conf not present] 
     85 
     86That is a good starting point. Right now your web server will not be 
     87running yet. We will only be using two of the available tabs to adjust 
     88some more settings: link:config_general.html[General] and 
     89link:config_virtual_servers.html[Virtual Servers]. 
     90 
     91This is an example of what you'll be seeing: 
     92 
     93image::media/images/admin_notrunning.png[Server not launched] 
     94 
     95Of course, once we're done we will have to apply our changes and 
     96launch the server. The configuration changes must be submitted to the 
     97server, be it automatically if possible or by using the appropriate form 
     98submitting buttons. But no change is reflected in the configuration 
     99file until you `Apply` the changes. You can be sure of not damaging 
     100anything while playing around with `cherokee-admin`. At least not 
     101until you `Apply` the changes. Note that, if the Cherokee server is 
     102running, the applied modifications will also affect the instance being 
     103executed. 
     104 
     105This is what the `General` tab looks like: 
     106image::media/images/admin_general.png[General] 
     107 
     108We will only be modifying the *Server Permissions*. It usually is a 
     109poor choice to run services with super user privileges. Set both 
     110*User* and *Group* to `www-data`. Your system might already have 
     111another user account specifically for the purpose of running a 
     112webserver. Use that instead if so, or create the `www-data` user if 
     113you don't already have one. 
     114 
     115Next is the link:config_virtual_servers.html[Virtual Servers] tab: 
     116 
     117image::media/images/admin_vserver.png[Virtual server] 
     118 
     119When you start, you will only have one virtual server called 
     120`default`. You can begin by cloning it as `example`. 
     121While you are at it you should also append the following line to your 
     122`/etc/hosts` file (in Windows you will find this as 
     123`%WINDIR%\system32\drivers\etc\hosts` 
     124 
     125---- 
     126127.0.0.1       example.net example.org 
     127---- 
     128 
     129This is to allow your system to resolve requests for `example.net` or 
     130`example.org` locally. Of course, once you are out in the Wild (you 
     131know, in the Internet), you will need proper DNS records. 
     132 
     133`default` 
     134^^^^^^^^^ 
     135We will leave default untouched except for the document root path, 
     136which we will change. This is done through the `Basics` tab. 
     137You could create by hand '/var/www/default' for example and set it up 
     138in the appropriate field. 
     139 
     140If you access your machine by IP or a DNS resolution points in that 
     141direction for any particular domain, the contents of your document 
     142root directory will be exposed ('/var/www' by default unless you 
     143changed that during the build process). 
     144 
     145Right now any file with the 'php' extension will be served after being 
     146processed by the PHP interpreter (you should have `php-cgi` installed 
     147in your system for this, though). 
     148 
     149Any requested file would be sent. If a directory is requested, a file 
     150called index.php or index.html will be served if it is present (the 
     151search will be performed in that order; you can configure this in the 
     152`Basics` tab). If not, a directory listing is offered instead. If you 
     153would want to prevent this behavior but would like to keep up 
     154serving whatever content is requested directly, simply change the 
     155`List & Send` handler for the `Static Content` handler. 
     156 
     157`example` 
     158^^^^^^^^^ 
     159For now this virtual server is an exact copy of the untouched 
     160`default` virtual server. Create some new directories 
     161'/var/wwww/example', '/var/wwww/example/auth' and 
     162'/var/www/example/redir', and configure the first one as default 
     163document root path. 
     164 
     165Next, setup `example.net` and `example.com` in the `Domain names` tab. 
     166We'll erase everything in the *Targets* list within the `Behavior` 
     167tab, except the `default` rule. With this we'll only be able to serve 
     168static content. 
     169 
     170Accessing the URL http://example.org should now show a list of 
     171available files and directories under '/var/www/example/'. 
     172 
     173Now lets password protect the `auth` directory. Add a new `Directory` 
     174class rule pointing to `/auth`. Then, through the `Security` tab, add 
     175a `Validation Mechanism` under `Authentication`. 
     176 
     177The field `Realm` is mandatory. Lets set it as `Secured Area`. 
     178If you choose `PAM` and impose no more restrictions, only users with 
     179a local account in your system will be able to access the secured zone 
     180at http://example.net/auth 
     181Other mechanisms would work in a similar fashion but with their 
     182specific requirements. For example, had you chosen `Plain text file` 
     183instead of PAM you would have had to specify a `Password File`. 
     184For example, it could have been `/var/www/passwords.txt` with the 
     185following contents: 
     186 
     187---- 
     188testuser1:password1 
     189testuser2:password2 
     190---- 
     191 
     192Note that the rule must not be flagged as `Final`, or else no other 
     193rules will be applied afterwards and no access will be given to any 
     194contents. This is because at this point we have not defined any 
     195handler for the `/auth` rule and nothing would be served. 
     196 
     197Refer to the Cookbook for detailed examples on the different options. 
     198 
     199Lastly, lets configure a redirection rule by choosing a "Regular 
     200Expression" as the new rule type. Type the following regex: `^/rss.*$` 
     201Then, within the `Handler` selection tab specify a target: `/feed` 
     202 
     203image::media/images/admin_rule_regex.png[Regex] 
     204 
     205And voilà! A request of the form http://example.net/rss2 would be 
     206redirected to http://example.net/feed 
     207 
     208A much more general redirection could be one using these values: 
     209 
     210* *Regular Expression*:: 
     211  `^/(.*)$` 
     212 
     213* *Substitution*:: 
     214  http://www.cherokee-project.com/example/$1 
     215 
     216This would redirect every petition to a mirror hosted elsewhere.