changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > werc / changeset: Replace '_' in paths in werc's docs section with '-', and set up apropriate redirects to avoid broken links.

changeset 635: dd58ad29ffbf
parent 634: 44d651b498d4
child 636: 9ab5110ba927
author: Uriel <u@berlinblue.org>
date: Sun, 30 May 2010 18:04:04 +0000
files: sites/werc.cat-v.org/docs/_werc/config sites/werc.cat-v.org/docs/config-options.md sites/werc.cat-v.org/docs/config_options.md sites/werc.cat-v.org/docs/css-style.md sites/werc.cat-v.org/docs/css_style.md sites/werc.cat-v.org/docs/dir-listings.md sites/werc.cat-v.org/docs/dir_listings.md sites/werc.cat-v.org/docs/rc-template-lang.md sites/werc.cat-v.org/docs/rc_template_lang.md sites/werc.cat-v.org/docs/site-customization.md sites/werc.cat-v.org/docs/site_customization.md sites/werc.cat-v.org/docs/user-management.md sites/werc.cat-v.org/docs/user_management.md sites/werc.cat-v.org/docs/web-server-setup/_header.md sites/werc.cat-v.org/docs/web-server-setup/apache.md sites/werc.cat-v.org/docs/web-server-setup/cherokee.md sites/werc.cat-v.org/docs/web-server-setup/hiawatha.md sites/werc.cat-v.org/docs/web-server-setup/lighttpd.md sites/werc.cat-v.org/docs/web-server-setup/nginx.md sites/werc.cat-v.org/docs/web-server-setup/nhttpd.md sites/werc.cat-v.org/docs/web-server-setup/plan-9-httpd.md sites/werc.cat-v.org/docs/web_server_setup/_header.md sites/werc.cat-v.org/docs/web_server_setup/apache.md sites/werc.cat-v.org/docs/web_server_setup/cherokee.md sites/werc.cat-v.org/docs/web_server_setup/hiawatha.md sites/werc.cat-v.org/docs/web_server_setup/lighttpd.md sites/werc.cat-v.org/docs/web_server_setup/nginx.md sites/werc.cat-v.org/docs/web_server_setup/nhttpd.md sites/werc.cat-v.org/docs/web_server_setup/plan_9_httpd.md
description: Replace '_' in paths in werc's docs section with '-', and set up apropriate redirects to avoid broken links.
     1.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2+++ b/sites/werc.cat-v.org/docs/_werc/config	Sun May 30 18:04:04 2010 +0000
     1.3@@ -0,0 +1,1 @@
     1.4+conf_perm_redirect _ -
     2.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2+++ b/sites/werc.cat-v.org/docs/config-options.md	Sun May 30 18:04:04 2010 +0000
     2.3@@ -0,0 +1,60 @@
     2.4+Werc Configuration Options
     2.5+==========================
     2.6+
     2.7+You can also find a description of some basic config options in the `etc/initrc` file itself.
     2.8+
     2.9+General Setup Options
    2.10+--------------------
    2.11+
    2.12+* `formatter` - Command to use for document formatting (usually some form of markdown), should be able to take input both from file names passed as arguments or from stdin if no file names are provided. By default: `formatter=(fltr_cache markdown.pl)`
    2.13+
    2.14+
    2.15+Titles and Metadata
    2.16+-------------------
    2.17+
    2.18+Variables:
    2.19+
    2.20+* Page title:
    2.21+    * siteTitle
    2.22+    * siteSubTitle
    2.23+
    2.24+* Html header meta tags:
    2.25+    * meta_description - `<meta name="description" ...`
    2.26+    * meta_keywords - `<meta name="keywords" ...`
    2.27+    * extraHeaders  - Raw extra html headers, the content of this var will be inserted inside the `<head>` tag..
    2.28+
    2.29+
    2.30+Sidebar and Navigation
    2.31+----------------------
    2.32+
    2.33+Variables:
    2.34+
    2.35+* sideBarNavTitle
    2.36+
    2.37+Functions:
    2.38+
    2.39+* `conf_hide_paths [path_patterns ...]` - Hide the given patterns from navigation menu, sitemap and dir listing (do *not* depend on this for security!).
    2.40+
    2.41+HTTP Control
    2.42+------------
    2.43+
    2.44+Variables:
    2.45+
    2.46+* extraHttpHeaders - Raw HTTP headers to be added to response.
    2.47+
    2.48+Functions:
    2.49+
    2.50+* `conf_perm_redirect [pattern] destination` - If pattern is provided, match it against the requested url, and replace the match with `destination`; ie., *s/pattern/destination/.
    2.51+
    2.52+
    2.53+Access Control and Permissions
    2.54+------------------------------
    2.55+
    2.56+The permissions system is very flexible, for example to only allow access to members of the group 'editors' you can do something like:
    2.57+
    2.58+    if(! check_user editors)
    2.59+        perm_redirect /_users/login
    2.60+
    2.61+To automatically redirect users without permission to the login page if they are not members of the group 'editors'.
    2.62+
    2.63+See also [the documentation on user and group management](user_management).
     3.1--- a/sites/werc.cat-v.org/docs/config_options.md	Mon May 24 23:35:08 2010 +0000
     3.2+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3@@ -1,60 +0,0 @@
     3.4-Werc Configuration Options
     3.5-==========================
     3.6-
     3.7-You can also find a description of some basic config options in the `etc/initrc` file itself.
     3.8-
     3.9-General Setup Options
    3.10---------------------
    3.11-
    3.12-* `formatter` - Command to use for document formatting (usually some form of markdown), should be able to take input both from file names passed as arguments or from stdin if no file names are provided. By default: `formatter=(fltr_cache markdown.pl)`
    3.13-
    3.14-
    3.15-Titles and Metadata
    3.16--------------------
    3.17-
    3.18-Variables:
    3.19-
    3.20-* Page title:
    3.21-    * siteTitle
    3.22-    * siteSubTitle
    3.23-
    3.24-* Html header meta tags:
    3.25-    * meta_description - `<meta name="description" ...`
    3.26-    * meta_keywords - `<meta name="keywords" ...`
    3.27-    * extraHeaders  - Raw extra html headers, the content of this var will be inserted inside the `<head>` tag..
    3.28-
    3.29-
    3.30-Sidebar and Navigation
    3.31-----------------------
    3.32-
    3.33-Variables:
    3.34-
    3.35-* sideBarNavTitle
    3.36-
    3.37-Functions:
    3.38-
    3.39-* `conf_hide_paths [path_patterns ...]` - Hide the given patterns from navigation menu, sitemap and dir listing (do *not* depend on this for security!).
    3.40-
    3.41-HTTP Control
    3.42-------------
    3.43-
    3.44-Variables:
    3.45-
    3.46-* extraHttpHeaders - Raw HTTP headers to be added to response.
    3.47-
    3.48-Functions:
    3.49-
    3.50-* `conf_perm_redirect [pattern] destination` - If pattern is provided, match it against the requested url, and replace the match with `destination`; ie., *s/pattern/destination/.
    3.51-
    3.52-
    3.53-Access Control and Permissions
    3.54-------------------------------
    3.55-
    3.56-The permissions system is very flexible, for example to only allow access to members of the group 'editors' you can do something like:
    3.57-
    3.58-    if(! check_user editors)
    3.59-        perm_redirect /_users/login
    3.60-
    3.61-To automatically redirect users without permission to the login page if they are not members of the group 'editors'.
    3.62-
    3.63-See also [the documentation on user and group management](user_management).
     4.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2+++ b/sites/werc.cat-v.org/docs/css-style.md	Sun May 30 18:04:04 2010 +0000
     4.3@@ -0,0 +1,18 @@
     4.4+Custom CSS Stylesheets
     4.5+=====================
     4.6+
     4.7+If you create a file under your site's dir at _werc/pub/style.css it will be included automatically after the standard werc stylesheet.
     4.8+
     4.9+You can copy pub/style/style.css and customize it, or you can take a simpler file and just change the main color theme.
    4.10+
    4.11+Here is an example of how to set the main werc colors:
    4.12+
    4.13+
    4.14+	body { background-color: #FFFFF7; }
    4.15+	.midHeader { background-color: #FFFFE9; }
    4.16+	#side-bar { background-color: #EFFFEF; }
    4.17+	#side-bar a { color: black; }
    4.18+	#side-bar a:hover {
    4.19+	  color: white!important;
    4.20+	  background-color: #428a42;
    4.21+	}
     5.1--- a/sites/werc.cat-v.org/docs/css_style.md	Mon May 24 23:35:08 2010 +0000
     5.2+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3@@ -1,18 +0,0 @@
     5.4-Custom CSS Stylesheets
     5.5-=====================
     5.6-
     5.7-If you create a file under your site's dir at _werc/pub/style.css it will be included automatically after the standard werc stylesheet.
     5.8-
     5.9-You can copy pub/style/style.css and customize it, or you can take a simpler file and just change the main color theme.
    5.10-
    5.11-Here is an example of how to set the main werc colors:
    5.12-
    5.13-
    5.14-	body { background-color: #FFFFF7; }
    5.15-	.midHeader { background-color: #FFFFE9; }
    5.16-	#side-bar { background-color: #EFFFEF; }
    5.17-	#side-bar a { color: black; }
    5.18-	#side-bar a:hover {
    5.19-	  color: white!important;
    5.20-	  background-color: #428a42;
    5.21-	}
     6.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2+++ b/sites/werc.cat-v.org/docs/dir-listings.md	Sun May 30 18:04:04 2010 +0000
     6.3@@ -0,0 +1,29 @@
     6.4+Autogenerated Directory Listings
     6.5+================================
     6.6+
     6.7+If a directory has no `index.md`, `index.html` or `index.txt` and has no other
     6.8+*main handler* set up by a [werc app](/apps/), the default directory listing
     6.9+handler is used.
    6.10+
    6.11+The default directory handler simply displays the path to the directory, and a
    6.12+list of links to all files and dirs located at this path.
    6.13+
    6.14+
    6.15+Header and footer
    6.16+-----------------
    6.17+
    6.18+If a `_header.md` or `_footer.md` files are found in the directory, their
    6.19+contents will be displayed in the corresponding sections before and after
    6.20+the directory contents.
    6.21+
    6.22+
    6.23+Tuning the item's order
    6.24+------------------------
    6.25+
    6.26+You can set the `dir_listing_ls_opts` config variable in the dir's corresponding _werc/config to change the way items will be ordered.
    6.27+
    6.28+For example to list items in reverse chronological order simply add:
    6.29+
    6.30+    dir_listing_ls_opts=( -t )
    6.31+
    6.32+The options taken are [the standard Plan 9 ls(1) flags](http://man.cat-v.org/plan_9/1/ls).
     7.1--- a/sites/werc.cat-v.org/docs/dir_listings.md	Mon May 24 23:35:08 2010 +0000
     7.2+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3@@ -1,29 +0,0 @@
     7.4-Autogenerated Directory Listings
     7.5-================================
     7.6-
     7.7-If a directory has no `index.md`, `index.html` or `index.txt` and has no other
     7.8-*main handler* set up by a [werc app](/apps/), the default directory listing
     7.9-handler is used.
    7.10-
    7.11-The default directory handler simply displays the path to the directory, and a
    7.12-list of links to all files and dirs located at this path.
    7.13-
    7.14-
    7.15-Header and footer
    7.16------------------
    7.17-
    7.18-If a `_header.md` or `_footer.md` files are found in the directory, their
    7.19-contents will be displayed in the corresponding sections before and after
    7.20-the directory contents.
    7.21-
    7.22-
    7.23-Tuning the item's order
    7.24-------------------------
    7.25-
    7.26-You can set the `dir_listing_ls_opts` config variable in the dir's corresponding _werc/config to change the way items will be ordered.
    7.27-
    7.28-For example to list items in reverse chronological order simply add:
    7.29-
    7.30-    dir_listing_ls_opts=( -t )
    7.31-
    7.32-The options taken are [the standard Plan 9 ls(1) flags](http://man.cat-v.org/plan_9/1/ls).
     8.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2+++ b/sites/werc.cat-v.org/docs/rc-template-lang.md	Sun May 30 18:04:04 2010 +0000
     8.3@@ -0,0 +1,46 @@
     8.4+The Rc Template Language
     8.5+========================
     8.6+
     8.7+Implemented by Kris, thanks!
     8.8+
     8.9+Basic syntax:
    8.10+
    8.11+* Lines starting with % are executed as rc commands, the resulting output is inserted in the document.
    8.12+* use %{ and %} to delimit multi line sections of rc code (note the lack of space between % and { or }!
    8.13+* To 'inline' the value of an environment variable use `%($my_var%)`
    8.14+
    8.15+That is basically it!
    8.16+
    8.17+For further documentation on rc see:
    8.18+
    8.19+* [The rc(1) man page for Plan 9](http://man.cat-v.org/plan_9/1/rc).
    8.20+* [The rc shell paper by Tom Duff](http://rc.cat-v.org).
    8.21+
    8.22+
    8.23+Examples
    8.24+--------
    8.25+
    8.26+Loops
    8.27+
    8.28+    <ul>
    8.29+    % for(i in a b c) {
    8.30+    %   echo '<li>'$i'</li>'
    8.31+    % }
    8.32+    </uL>
    8.33+ 
    8.34+Is equivalent to: 
    8.35+
    8.36+    <ul>
    8.37+    % for(i in a b c) {
    8.38+    <li>%($i%)</li>
    8.39+    % }
    8.40+    </uL>
    8.41+
    8.42+and results in this output:
    8.43+
    8.44+    <ul>
    8.45+    <li>a</li>
    8.46+    <li>b</li>
    8.47+    <li>c</li>
    8.48+    </ul>
    8.49+
     9.1--- a/sites/werc.cat-v.org/docs/rc_template_lang.md	Mon May 24 23:35:08 2010 +0000
     9.2+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3@@ -1,46 +0,0 @@
     9.4-The Rc Template Language
     9.5-========================
     9.6-
     9.7-Implemented by Kris, thanks!
     9.8-
     9.9-Basic syntax:
    9.10-
    9.11-* Lines starting with % are executed as rc commands, the resulting output is inserted in the document.
    9.12-* use %{ and %} to delimit multi line sections of rc code (note the lack of space between % and { or }!
    9.13-* To 'inline' the value of an environment variable use `%($my_var%)`
    9.14-
    9.15-That is basically it!
    9.16-
    9.17-For further documentation on rc see:
    9.18-
    9.19-* [The rc(1) man page for Plan 9](http://man.cat-v.org/plan_9/1/rc).
    9.20-* [The rc shell paper by Tom Duff](http://rc.cat-v.org).
    9.21-
    9.22-
    9.23-Examples
    9.24---------
    9.25-
    9.26-Loops
    9.27-
    9.28-    <ul>
    9.29-    % for(i in a b c) {
    9.30-    %   echo '<li>'$i'</li>'
    9.31-    % }
    9.32-    </uL>
    9.33- 
    9.34-Is equivalent to: 
    9.35-
    9.36-    <ul>
    9.37-    % for(i in a b c) {
    9.38-    <li>%($i%)</li>
    9.39-    % }
    9.40-    </uL>
    9.41-
    9.42-and results in this output:
    9.43-
    9.44-    <ul>
    9.45-    <li>a</li>
    9.46-    <li>b</li>
    9.47-    <li>c</li>
    9.48-    </ul>
    9.49-
    10.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2+++ b/sites/werc.cat-v.org/docs/site-customization.md	Sun May 30 18:04:04 2010 +0000
    10.3@@ -0,0 +1,50 @@
    10.4+Site Customization
    10.5+==================
    10.6+
    10.7+To change any of the default templates and include files simply copy them
    10.8+from /lib/ to your site's _werc/lib/ and edit at will.
    10.9+
   10.10+File Types
   10.11+----------
   10.12+
   10.13+* '.tpl' files are rc [template files](rc_template_lang).
   10.14+* '.inc' are text files that are inserted 'as is' without any extra processing.
   10.15+
   10.16+Site Groups
   10.17+-----------
   10.18+
   10.19+Site configuration and customization and be 'grouped' to allow a shared set of templates among a specific group of sites (useful for sets of sub-domains for example).
   10.20+
   10.21+Simply set 'masterSite' configuration variable to the name of the site you want to 'inherit' templates, style and configuration from.
   10.22+
   10.23+For example, if we have two sites bar.com and foo.bar.com, and in sites/foo.bar.com/_werc/conf we add:
   10.24+
   10.25+    masterSite=bar.com
   10.26+
   10.27+When a template (eg., 404.tpl) is requested it will be looked up first in /sites/foo.bar.com/_werc/lib/404.tpl, if that fails then in /sites/bar.com/_werc/lib/, and if that is missing too, the default /lib/404.tpl is used.
   10.28+
   10.29+The same applies to .inc files.
   10.30+
   10.31+
   10.32+List of Template and Included Files
   10.33+-----------------------------------
   10.34+
   10.35+Here is a list of the most commonly used templates and include files with their corresponding descriptions.
   10.36+
   10.37+Include:
   10.38+
   10.39+* top_bar.inc: The thin header at the top of every page, usually contains static links to other related sites or anything else you like.
   10.40+* footer.inc: Similar but at the bottom of every page, by default  includes a link to the user login page.
   10.41+* headers.inc: Raw html headers to be included inside <head> tag.
   10.42+
   10.43+Templates:
   10.44+
   10.45+* default_master.tpl: This is the main template, which calls all the sidebar and other handlers and applications, usually you won't need to edit it unless you want to make changes to the layout or similar dramatic changes.
   10.46+* sitemap.tpl: Template for the sitemap page.
   10.47+* 404.tpl: Template for 'File Not Found' pages.
   10.48+
   10.49+
   10.50+See also
   10.51+--------
   10.52+
   10.53+* [CSS style sheets customization](css_style).
    11.1--- a/sites/werc.cat-v.org/docs/site_customization.md	Mon May 24 23:35:08 2010 +0000
    11.2+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3@@ -1,50 +0,0 @@
    11.4-Site Customization
    11.5-==================
    11.6-
    11.7-To change any of the default templates and include files simply copy them
    11.8-from /lib/ to your site's _werc/lib/ and edit at will.
    11.9-
   11.10-File Types
   11.11-----------
   11.12-
   11.13-* '.tpl' files are rc [template files](rc_template_lang).
   11.14-* '.inc' are text files that are inserted 'as is' without any extra processing.
   11.15-
   11.16-Site Groups
   11.17------------
   11.18-
   11.19-Site configuration and customization and be 'grouped' to allow a shared set of templates among a specific group of sites (useful for sets of sub-domains for example).
   11.20-
   11.21-Simply set 'masterSite' configuration variable to the name of the site you want to 'inherit' templates, style and configuration from.
   11.22-
   11.23-For example, if we have two sites bar.com and foo.bar.com, and in sites/foo.bar.com/_werc/conf we add:
   11.24-
   11.25-    masterSite=bar.com
   11.26-
   11.27-When a template (eg., 404.tpl) is requested it will be looked up first in /sites/foo.bar.com/_werc/lib/404.tpl, if that fails then in /sites/bar.com/_werc/lib/, and if that is missing too, the default /lib/404.tpl is used.
   11.28-
   11.29-The same applies to .inc files.
   11.30-
   11.31-
   11.32-List of Template and Included Files
   11.33------------------------------------
   11.34-
   11.35-Here is a list of the most commonly used templates and include files with their corresponding descriptions.
   11.36-
   11.37-Include:
   11.38-
   11.39-* top_bar.inc: The thin header at the top of every page, usually contains static links to other related sites or anything else you like.
   11.40-* footer.inc: Similar but at the bottom of every page, by default  includes a link to the user login page.
   11.41-* headers.inc: Raw html headers to be included inside <head> tag.
   11.42-
   11.43-Templates:
   11.44-
   11.45-* default_master.tpl: This is the main template, which calls all the sidebar and other handlers and applications, usually you won't need to edit it unless you want to make changes to the layout or similar dramatic changes.
   11.46-* sitemap.tpl: Template for the sitemap page.
   11.47-* 404.tpl: Template for 'File Not Found' pages.
   11.48-
   11.49-
   11.50-See also
   11.51---------
   11.52-
   11.53-* [CSS style sheets customization](css_style).
    12.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2+++ b/sites/werc.cat-v.org/docs/user-management.md	Sun May 30 18:04:04 2010 +0000
    12.3@@ -0,0 +1,36 @@
    12.4+User and Group Management
    12.5+=========================
    12.6+
    12.7+User account and group membership information are stored under `etc/users/`.
    12.8+
    12.9+A user account consists of a directory under `etc/users/` that contains files with that users account information, the only required file is `password` containing a password for the user. For example:
   12.10+
   12.11+	% ls etc/users/
   12.12+	eekee  uriel  yosyp
   12.13+	% cat etc/users/uriel/password
   12.14+	mypass
   12.15+
   12.16+Users and groups share the same namespace, you can create a group the same way you create a user but instead of a 'password' file adding a 'members' file containing the names of the group members, one per line.
   12.17+
   12.18+A 'user-group' directory can contain both a password and members file, in which case it will act concurrently as a user and as a group.
   12.19+
   12.20+The group 'admin' is 'built-in' and any members in that group will have admin privileges for most werc apps by default.
   12.21+
   12.22+Example
   12.23+-------
   12.24+
   12.25+To create a user called [glenda](http://glenda.cat-v.org) that is a member of the group `rabbits` you can do:
   12.26+
   12.27+	% mkdir etc/users/glenda/
   12.28+	% echo carrot > etc/users/glenda/password
   12.29+	% mkdir -p etc/users/rabbits
   12.30+	% echo glenda >> etc/users/rabbits/members
   12.31+
   12.32+Utils
   12.33+-----
   12.34+
   12.35+The script at bin/aux/addwuser.rc allows you to even more trivially add users. 
   12.36+
   12.37+	addwuser.rc user_name user_pass [groups ...]
   12.38+
   12.39+
    13.1--- a/sites/werc.cat-v.org/docs/user_management.md	Mon May 24 23:35:08 2010 +0000
    13.2+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3@@ -1,36 +0,0 @@
    13.4-User and Group Management
    13.5-=========================
    13.6-
    13.7-User account and group membership information are stored under `etc/users/`.
    13.8-
    13.9-A user account consists of a directory under `etc/users/` that contains files with that users account information, the only required file is `password` containing a password for the user. For example:
   13.10-
   13.11-	% ls etc/users/
   13.12-	eekee  uriel  yosyp
   13.13-	% cat etc/users/uriel/password
   13.14-	mypass
   13.15-
   13.16-Users and groups share the same namespace, you can create a group the same way you create a user but instead of a 'password' file adding a 'members' file containing the names of the group members, one per line.
   13.17-
   13.18-A 'user-group' directory can contain both a password and members file, in which case it will act concurrently as a user and as a group.
   13.19-
   13.20-The group 'admin' is 'built-in' and any members in that group will have admin privileges for most werc apps by default.
   13.21-
   13.22-Example
   13.23--------
   13.24-
   13.25-To create a user called [glenda](http://glenda.cat-v.org) that is a member of the group `rabbits` you can do:
   13.26-
   13.27-	% mkdir etc/users/glenda/
   13.28-	% echo carrot > etc/users/glenda/password
   13.29-	% mkdir -p etc/users/rabbits
   13.30-	% echo glenda >> etc/users/rabbits/members
   13.31-
   13.32-Utils
   13.33------
   13.34-
   13.35-The script at bin/aux/addwuser.rc allows you to even more trivially add users. 
   13.36-
   13.37-	addwuser.rc user_name user_pass [groups ...]
   13.38-
   13.39-
    14.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2+++ b/sites/werc.cat-v.org/docs/web-server-setup/_header.md	Sun May 30 18:04:04 2010 +0000
    14.3@@ -0,0 +1,16 @@
    14.4+Setting Up Your HTTP Server to Run Werc
    14.5+=======================================
    14.6+
    14.7+
    14.8+Werc should work with any web server that supports the CGI interface, and a few
    14.9+that don't. Here are collected instructions and sample configurations for some
   14.10+of the most popular HTTP servers that people has used with werc.
   14.11+
   14.12+In general setup consists of mapping all paths for a virtual host to the
   14.13+werc.rc script, usually in practice this means that the `document root` (or
   14.14+similar concept) for a virtual host is mapped to
   14.15+`/path/to/werc/sites/domain.name.com/`, and if no static file matches the
   14.16+request, control is handed to werc.rc, this allows the HTTP server to handle
   14.17+static files and werc to handle everything else (note that such a setup will
   14.18+expose your `_werc/config` files, which usually should not be a security
   14.19+issue).
    15.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2+++ b/sites/werc.cat-v.org/docs/web-server-setup/apache.md	Sun May 30 18:04:04 2010 +0000
    15.3@@ -0,0 +1,92 @@
    15.4+Setup werc with Apache
    15.5+======================
    15.6+
    15.7+Note: Apache 2.x configuration should be similar to 1.3.x, but Apache 2.x is not recommended due to unwindy complexity, please use a saner web server.
    15.8+
    15.9+Apache 1.3.x: minimalist configuration
   15.10+======================================
   15.11+
   15.12+No virtual hosts and let werc handle static files.
   15.13+
   15.14+    RewriteEngine On
   15.15+    ServerName test.cat-v.org
   15.16+    AddHandler cgi-script .rc
   15.17+
   15.18+    <Directory /var/www/werc/bin>
   15.19+        Options ExecCGI
   15.20+    </Directory>
   15.21+    <IfModule mod_dir.c>
   15.22+        DirectoryIndex /werc.rc
   15.23+    </IfModule>
   15.24+
   15.25+    RewriteRule /werc.rc /var/www/werc/bin/werc.rc
   15.26+    DocumentRoot /var/www/werc/bin/
   15.27+    ErrorDocument 404 /werc.rc
   15.28+
   15.29+
   15.30+Apache 1.3.x: standard configuration
   15.31+====================================
   15.32+
   15.33+This lets apache handle static files.
   15.34+
   15.35+    <VirtualHost *>
   15.36+
   15.37+        RewriteEngine On
   15.38+        ServerName test.cat-v.org
   15.39+        AddHandler cgi-script .rc
   15.40+
   15.41+        <Directory /var/wwww/werc/bin>
   15.42+            Options ExecCGI
   15.43+        </Directory>
   15.44+        <IfModule mod_dir.c>
   15.45+            DirectoryIndex /werc.rc
   15.46+        </IfModule>
   15.47+
   15.48+        RewriteRule (.*) /var/www/werc/sites/%{HTTP_HOST}/$1
   15.49+
   15.50+        RewriteCond %{REQUEST_FILENAME} !-f
   15.51+        RewriteRule .* /var/www/werc/bin/werc.rc
   15.52+
   15.53+        RewriteRule /werc.rc /var/www/werc/bin/werc.rc
   15.54+        DocumentRoot /var/www/werc/bin/
   15.55+        ErrorDocument 404 /werc.rc
   15.56+
   15.57+    </VirtualHost>
   15.58+
   15.59+
   15.60+Apache 1.3.x: advanced configuration
   15.61+====================================
   15.62+
   15.63+
   15.64+    <VirtualHost *>
   15.65+
   15.66+        RewriteEngine On
   15.67+        ServerName cat-v.org
   15.68+        ServerAlias www.cat-v.org harmful.cat-v.org 9p.cat-v.org gsoc.cat-v.org doc.cat-v.org uriel.cat-v.org www.binarydream.org ninetimes.cat-v.org *.cat-v.org
   15.69+        AddHandler cgi-script .rc
   15.70+        AddHandler cgi-script .cgi
   15.71+        <Directory /home/uriel/cat-v.org/bin>
   15.72+            Options ExecCGI
   15.73+        </Directory>
   15.74+        <IfModule mod_dir.c>
   15.75+            DirectoryIndex /werc.rc
   15.76+        </IfModule>
   15.77+
   15.78+        RewriteRule ^/hg/(.*)    /home/uriel/cat-v.org/bin/hgwebdir.cgi/$1 [L]
   15.79+
   15.80+        RewriteRule /pub/style/style.css /home/uriel/cat-v.org/pub/style/style.css [L]
   15.81+        RewriteRule /pub/ /home/uriel/cat-v.org/pub/ [L]
   15.82+        RewriteRule /favicon.ico /home/uriel/cat-v.org/pub/default_favicon.ico [L]
   15.83+
   15.84+
   15.85+        RewriteRule (.*) /home/uriel/cat-v.org/sites/%{HTTP_HOST}/$1
   15.86+
   15.87+        RewriteCond %{REQUEST_FILENAME} !-f
   15.88+        RewriteRule .* /home/uriel/cat-v.org/bin/werc.rc
   15.89+
   15.90+        RewriteRule /werc.rc /home/uriel/cat-v.org/bin/werc.rc
   15.91+        DocumentRoot /home/uriel/cat-v.org/bin/
   15.92+        ErrorDocument 404 /werc.rc
   15.93+
   15.94+    </VirtualHost>
   15.95+
    16.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2+++ b/sites/werc.cat-v.org/docs/web-server-setup/cherokee.md	Sun May 30 18:04:04 2010 +0000
    16.3@@ -0,0 +1,31 @@
    16.4+Configuring werc with Cherokee
    16.5+==============================
    16.6+
    16.7+Contributed by sqweek, thanks!
    16.8+
    16.9+Cherokee Version 0.7.1
   16.10+----------------------
   16.11+
   16.12+    vserver!default!rule!600!only_secure = 0
   16.13+    vserver!default!rule!600!handler = cgi
   16.14+    vserver!default!rule!600!handler!error_handler = 1
   16.15+    vserver!default!rule!600!handler!check_file = 1
   16.16+    vserver!default!rule!600!handler!script_alias =
   16.17+    /usr/local/werc/bin/werc.rc
   16.18+    vserver!default!rule!600!handler!pass_req_headers = 0
   16.19+    vserver!default!rule!600!match = directory
   16.20+    vserver!default!rule!600!match!directory = /code
   16.21+    vserver!default!rule!600!match!final = 1
   16.22+
   16.23+
   16.24+Cherokee Version 0.5.3
   16.25+----------------------
   16.26+
   16.27+    Directory /code {
   16.28+           Handler cgi {
   16.29+               Scriptalias /usr/local/werc/bin/werc.rc
   16.30+           }
   16.31+    }
   16.32+
   16.33+
   16.34+Isn't progress wonderful?
    17.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2+++ b/sites/werc.cat-v.org/docs/web-server-setup/hiawatha.md	Sun May 30 18:04:04 2010 +0000
    17.3@@ -0,0 +1,16 @@
    17.4+Hiawatha Web Server Configuration
    17.5+---------------------------------
    17.6+
    17.7+Contributed by sqweek, thanks!
    17.8+
    17.9+This are the relevant bits:
   17.10+
   17.11+    CGIhandler = /usr/local/plan9/bin/rc:rc
   17.12+    ExecuteCGI = yes
   17.13+    RewriteURL = werc
   17.14+    UrlRewrite {
   17.15+        RewriteID = werc
   17.16+        Match ^(/code|/index|/contact|/clique).* Rewrite /werc.rc
   17.17+        Match ^/$ Rewrite /werc.rc
   17.18+    }
   17.19+
    18.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2+++ b/sites/werc.cat-v.org/docs/web-server-setup/lighttpd.md	Sun May 30 18:04:04 2010 +0000
    18.3@@ -0,0 +1,44 @@
    18.4+Setup werc with lighttpd
    18.5+========================
    18.6+
    18.7+You will need to enable to the following modules: `mod_cgi`, `mod_alias` and `mod_rewrite` (for non-minimal configurations).
    18.8+
    18.9+You can also find `mod_setenv` useful to change werc's environment ($PATH in perticular)
   18.10+
   18.11+Minimal setup
   18.12+-------------
   18.13+This is the most minimal setup, for a single domain, and lets werc handle static files.
   18.14+
   18.15+    $HTTP["host"] =~ "^test\.cat-v\.org$" {
   18.16+        index-file.names = ( )
   18.17+        server.error-handler-404 = "/werc.rc"
   18.18+        alias.url       += ( "/werc.rc" => "/var/www/cat-v.org/bin/werc.rc" ) # Here use the path to werc.rc in your system.
   18.19+        cgi.assign += ( ".rc" => "")
   18.20+        server.dir-listing = "disable"
   18.21+    }
   18.22+
   18.23+Advanced setup
   18.24+--------------
   18.25+
   18.26+A more ellaborate setup, using virtual hosts to handle multiple domains, and
   18.27+alias to let lighttpd handle static files.  Also show how to add external cgi's
   18.28+to the setup, in this case Mercurial's web interface.
   18.29+
   18.30+    $HTTP["host"] =~ "^((harmful|9p|gsoc|doc|uriel|src|repo|www|)(\.|)cat-v\.org|(www\.)?binarydream.org|)$" {
   18.31+
   18.32+        index-file.names = ( )
   18.33+        evhost.path-pattern     = "/var/www/cat-v.org/sites/%3.%0/"
   18.34+        server.error-handler-404 = "/werc.rc"
   18.35+
   18.36+        alias.url       += ( "/pub/" => "/var/www/cat-v.org/pub/" )
   18.37+        alias.url       += ( "/favicon.ico" => "/var/www/cat-v.org/pub/default_favicon.ico" )
   18.38+        alias.url       += ( "/doc/" => "/var/www/cat-v.org/sites/doc.cat-v.org/" )
   18.39+        alias.url       += ( "/werc.rc" => "/var/www/cat-v.org/bin/werc.rc" )
   18.40+        alias.url       += ( "/debug.rc" => "/var/www/cat-v.org/bin/debug.rc" )
   18.41+        cgi.assign += ( ".rc" => "")
   18.42+        server.dir-listing = "disable"
   18.43+
   18.44+        cgi.assign += ( ".cgi" => "")
   18.45+        url.rewrite-once = ( "/hg/(.*)" => "/hg/hgwebdir.cgi/$1" )
   18.46+        alias.url       += ( "/hg/" => "/var/www/cat-v.org/bin/"  )
   18.47+    }
    19.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2+++ b/sites/werc.cat-v.org/docs/web-server-setup/nginx.md	Sun May 30 18:04:04 2010 +0000
    19.3@@ -0,0 +1,96 @@
    19.4+Setup werc with NGINX
    19.5+=====================
    19.6+
    19.7+You probably will want to to use fcgiwrap, called from spawn-fcgi or similar.
    19.8+
    19.9+Here is an extremely basic nginx configuration, with this configuration static files will be handled by werc and not nginx, this is clearly dumb, but works:
   19.10+
   19.11+        worker_processes  1;
   19.12+
   19.13+        #error_log  logs/error.log;
   19.14+        #error_log  logs/error.log  notice;
   19.15+        error_log  logs/error.log  info;
   19.16+
   19.17+        pid        logs/nginx.pid;
   19.18+
   19.19+        events {
   19.20+            worker_connections  1024;
   19.21+        }
   19.22+
   19.23+
   19.24+        http {
   19.25+        include       mime.types;
   19.26+        default_type  application/octet-stream;
   19.27+
   19.28+        #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
   19.29+        #                  '$status $body_bytes_sent "$http_referer" '
   19.30+        #                  '"$http_user_agent" "$http_x_forwarded_for"';
   19.31+
   19.32+        #access_log  logs/access.log  main;
   19.33+
   19.34+        sendfile        on;
   19.35+        #tcp_nopush     on;
   19.36+
   19.37+        #keepalive_timeout  0;
   19.38+        keepalive_timeout  65;
   19.39+
   19.40+        #gzip  on;
   19.41+
   19.42+        server {
   19.43+            listen       80;
   19.44+            server_name  test.cat-v.org; # Replace with your domain name.
   19.45+
   19.46+            #charset utf-8;
   19.47+
   19.48+            #access_log  logs/host.access.log  main;
   19.49+
   19.50+            location / {
   19.51+
   19.52+            # FastCGI params, usually stored in fastcgi_params
   19.53+            # and imported with a command like the following:
   19.54+            #include        fastcgi_params;
   19.55+
   19.56+            # Typical contents of fastcgi_params (inlined here):
   19.57+            fastcgi_pass localhost:9000;
   19.58+
   19.59+            fastcgi_param  QUERY_STRING       $query_string;
   19.60+            fastcgi_param  REQUEST_METHOD     $request_method;
   19.61+            fastcgi_param  CONTENT_TYPE       $content_type;
   19.62+            fastcgi_param  CONTENT_LENGTH     $content_length;
   19.63+
   19.64+            #fastcgi_param  SCRIPT_FILENAME   /var/www/werc/bin/werc.rc;
   19.65+            fastcgi_param  SCRIPT_NAME        /var/www/werc/bin/werc.rc;
   19.66+            #fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
   19.67+
   19.68+            fastcgi_param  REQUEST_URI        $request_uri;
   19.69+            fastcgi_param  DOCUMENT_URI       $document_uri;
   19.70+            fastcgi_param  DOCUMENT_ROOT      $document_root;
   19.71+            fastcgi_param  SERVER_PROTOCOL    $server_protocol;
   19.72+
   19.73+            fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
   19.74+            fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;
   19.75+
   19.76+            fastcgi_param  REMOTE_ADDR        $remote_addr;
   19.77+            fastcgi_param  REMOTE_PORT        $remote_port;
   19.78+            fastcgi_param  SERVER_ADDR        $server_addr;
   19.79+            fastcgi_param  SERVER_PORT        $server_port;
   19.80+            fastcgi_param  SERVER_NAME        $server_name;
   19.81+            fastcgi_param  REMOTE_USER        $remote_user;
   19.82+
   19.83+            #root   /var/www/werc/sites/$server_addr; # XXX This doesn't work, not sure why :(
   19.84+            root /;
   19.85+            #index  index.html index.htm;
   19.86+            }
   19.87+        }
   19.88+    }
   19.89+
   19.90+
   19.91+Then you can use spawn-fcgi or similar to get wrapcgi going:
   19.92+
   19.93+	spawn-fcgi -a 127.0.0.1 -p 9000 -f /home/uriel/dvl/ext/fcgiwrap/fcgiwrap # Use the path to your fcgiwrap binary here
   19.94+
   19.95+
   19.96+Other Setups
   19.97+------------
   19.98+
   19.99+More elaborate setups with direct handling of static files, caching, and multiple fcgi/cgi handlers should be easy, if you have any please post them to the werc9 mailing list.
    20.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2+++ b/sites/werc.cat-v.org/docs/web-server-setup/nhttpd.md	Sun May 30 18:04:04 2010 +0000
    20.3@@ -0,0 +1,60 @@
    20.4+Nhttpd/Nostromo  Web Server Configuration for Werc
    20.5+==================================================
    20.6+
    20.7+Contributed by nsz, thanks!
    20.8+
    20.9+The last two sections are relevant: aliases (to make non-content site material,
   20.10+like css, available) and virtual hosts (the document root is set to `werc.rc`
   20.11+so it will handle every request).
   20.12+
   20.13+    # MAIN [MANDATORY]
   20.14+    
   20.15+    servername      main.host.com
   20.16+    serveradmin     admin[at]mail.com
   20.17+    serverroot      /var/nostromo
   20.18+    servermimes     conf/mimes
   20.19+    logpid          logs/nhttpd.pid
   20.20+    logaccess       logs/access_log
   20.21+    docroot         /var/nostromo/htdocs
   20.22+    docindex        index.html
   20.23+    
   20.24+    # SETUID [RECOMMENDED]
   20.25+    
   20.26+    user            nhttpd
   20.27+    
   20.28+    # BASIC AUTHENTICATION [OPTIONAL]
   20.29+    #...
   20.30+    
   20.31+    # SSL [OPTIONAL]
   20.32+    #...
   20.33+    
   20.34+    # CUSTOM RESPONSES [OPTIONAL]
   20.35+    #...
   20.36+    
   20.37+    # HOMEDIRS [OPTIONAL]
   20.38+    #...
   20.39+    
   20.40+    # ALIASES [OPTIONAL]
   20.41+    
   20.42+    /pub            /path/to/werc/pub
   20.43+    # The following line doesn't work because nhttpd doesn't support file aliases yet.
   20.44+    #/favicon.ico        /path/to/werc/pub/default_favicon.ico
   20.45+    
   20.46+    # VIRTUAL HOSTS [OPTIONAL]
   20.47+    
   20.48+    vhost1.com      /path/to/werc/bin/werc.rc
   20.49+    vhost2.com      /path/to/werc/bin/werc.rc
   20.50+    #...
   20.51+
   20.52+To use werc on `main.host.com` as well just set `docroot` to `/path/to/werc/bin/werc.rc`
   20.53+and set `docindex` to empty string.
   20.54+
   20.55+There was a bug in nhttpd <=1.9, it did not set `SERVER_NAME` properly (left it `main.host.com`).
   20.56+To solve this problem just add a
   20.57+
   20.58+    SERVER_NAME=$HTTP_HOST
   20.59+
   20.60+line somewhere at the top of `werc.rc`.
   20.61+
   20.62+
   20.63+
    21.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2+++ b/sites/werc.cat-v.org/docs/web-server-setup/plan-9-httpd.md	Sun May 30 18:04:04 2010 +0000
    21.3@@ -0,0 +1,53 @@
    21.4+Setup werc with Plan 9's httpd
    21.5+==============================
    21.6+
    21.7+
    21.8+There are two main options, you can use Russ Cox's magic to cgi translator
    21.9+(found in his contrib dir as cgi.c), or you can use the following script which
   21.10+while simpler, it also lacks some features at the moment.
   21.11+
   21.12+Thanks to soul9 for the original idea of wrapping werc in a shell script that
   21.13+would setup a cgi-like environment!
   21.14+
   21.15+
   21.16+    #!/bin/rc
   21.17+
   21.18+    SERVER_NAME=$2
   21.19+    REQUEST_URI=`{echo $*(15)}
   21.20+    REQUEST_URI=$REQUEST_URI(2)
   21.21+    REQUEST_URI=/
   21.22+    REQUEST_METHOD=$*(16)
   21.23+    PLAN9=/
   21.24+
   21.25+
   21.26+    echo 'HTTP/1.0 200 Ok
   21.27+    Connection: close
   21.28+    Server: werc/9.9.9' # This is whatever you like
   21.29+
   21.30+
   21.31+    cd /usr/web/bin/
   21.32+    rfork
   21.33+    /bin/rc < ./werc.rc >[2]/usr/glenda/tmp/w/log # Use whatever location you like to log stderr, but make sure it is writable by none.
   21.34+
   21.35+Call this script werc-wrap, and put it in /rc/bin/ip/httpd/
   21.36+
   21.37+Then in your /sys/lib/httpd.rewrite  add a line like:
   21.38+
   21.39+    /w @/magic/werc-wrap
   21.40+
   21.41+And this will run werc for all stuff under /w. Note that apparently httpd is
   21.42+incapable of internally remapping the root directory, so until a solution is
   21.43+found for this, you will have to keep your site in a sub-directory of the web
   21.44+server root.
   21.45+
   21.46+In your /lib/namespace.httpd you probably will want to add something along the
   21.47+following lines to bind the werc directory into the httpd's namespace:
   21.48+
   21.49+    bind -b /usr/glenda/src/werc/ /usr/web/
   21.50+    bind /usr/glenda/src/werc/bin/ /usr/web/magic/
   21.51+
   21.52+
   21.53+**Notes**: This is experimental and work in progress, there are a couple of issues
   21.54+with the werc code itself that might need fixing, in particular you will need
   21.55+to replace the '%($"extraHeaders%)' in lib/headers.tpl with '% echo
   21.56+$"extraHeaders' no clue why.
    22.1--- a/sites/werc.cat-v.org/docs/web_server_setup/_header.md	Mon May 24 23:35:08 2010 +0000
    22.2+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.3@@ -1,16 +0,0 @@
    22.4-Setting Up Your HTTP Server to Run Werc
    22.5-=======================================
    22.6-
    22.7-
    22.8-Werc should work with any web server that supports the CGI interface, and a few
    22.9-that don't. Here are collected instructions and sample configurations for some
   22.10-of the most popular HTTP servers that people has used with werc.
   22.11-
   22.12-In general setup consists of mapping all paths for a virtual host to the
   22.13-werc.rc script, usually in practice this means that the `document root` (or
   22.14-similar concept) for a virtual host is mapped to
   22.15-`/path/to/werc/sites/domain.name.com/`, and if no static file matches the
   22.16-request, control is handed to werc.rc, this allows the HTTP server to handle
   22.17-static files and werc to handle everything else (note that such a setup will
   22.18-expose your `_werc/config` files, which usually should not be a security
   22.19-issue).
    23.1--- a/sites/werc.cat-v.org/docs/web_server_setup/apache.md	Mon May 24 23:35:08 2010 +0000
    23.2+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.3@@ -1,92 +0,0 @@
    23.4-Setup werc with Apache
    23.5-======================
    23.6-
    23.7-Note: Apache 2.x configuration should be similar to 1.3.x, but Apache 2.x is not recommended due to unwindy complexity, please use a saner web server.
    23.8-
    23.9-Apache 1.3.x: minimalist configuration
   23.10-======================================
   23.11-
   23.12-No virtual hosts and let werc handle static files.
   23.13-
   23.14-    RewriteEngine On
   23.15-    ServerName test.cat-v.org
   23.16-    AddHandler cgi-script .rc
   23.17-
   23.18-    <Directory /var/www/werc/bin>
   23.19-        Options ExecCGI
   23.20-    </Directory>
   23.21-    <IfModule mod_dir.c>
   23.22-        DirectoryIndex /werc.rc
   23.23-    </IfModule>
   23.24-
   23.25-    RewriteRule /werc.rc /var/www/werc/bin/werc.rc
   23.26-    DocumentRoot /var/www/werc/bin/
   23.27-    ErrorDocument 404 /werc.rc
   23.28-
   23.29-
   23.30-Apache 1.3.x: standard configuration
   23.31-====================================
   23.32-
   23.33-This lets apache handle static files.
   23.34-
   23.35-    <VirtualHost *>
   23.36-
   23.37-        RewriteEngine On
   23.38-        ServerName test.cat-v.org
   23.39-        AddHandler cgi-script .rc
   23.40-
   23.41-        <Directory /var/wwww/werc/bin>
   23.42-            Options ExecCGI
   23.43-        </Directory>
   23.44-        <IfModule mod_dir.c>
   23.45-            DirectoryIndex /werc.rc
   23.46-        </IfModule>
   23.47-
   23.48-        RewriteRule (.*) /var/www/werc/sites/%{HTTP_HOST}/$1
   23.49-
   23.50-        RewriteCond %{REQUEST_FILENAME} !-f
   23.51-        RewriteRule .* /var/www/werc/bin/werc.rc
   23.52-
   23.53-        RewriteRule /werc.rc /var/www/werc/bin/werc.rc
   23.54-        DocumentRoot /var/www/werc/bin/
   23.55-        ErrorDocument 404 /werc.rc
   23.56-
   23.57-    </VirtualHost>
   23.58-
   23.59-
   23.60-Apache 1.3.x: advanced configuration
   23.61-====================================
   23.62-
   23.63-
   23.64-    <VirtualHost *>
   23.65-
   23.66-        RewriteEngine On
   23.67-        ServerName cat-v.org
   23.68-        ServerAlias www.cat-v.org harmful.cat-v.org 9p.cat-v.org gsoc.cat-v.org doc.cat-v.org uriel.cat-v.org www.binarydream.org ninetimes.cat-v.org *.cat-v.org
   23.69-        AddHandler cgi-script .rc
   23.70-        AddHandler cgi-script .cgi
   23.71-        <Directory /home/uriel/cat-v.org/bin>
   23.72-            Options ExecCGI
   23.73-        </Directory>
   23.74-        <IfModule mod_dir.c>
   23.75-            DirectoryIndex /werc.rc
   23.76-        </IfModule>
   23.77-
   23.78-        RewriteRule ^/hg/(.*)    /home/uriel/cat-v.org/bin/hgwebdir.cgi/$1 [L]
   23.79-
   23.80-        RewriteRule /pub/style/style.css /home/uriel/cat-v.org/pub/style/style.css [L]
   23.81-        RewriteRule /pub/ /home/uriel/cat-v.org/pub/ [L]
   23.82-        RewriteRule /favicon.ico /home/uriel/cat-v.org/pub/default_favicon.ico [L]
   23.83-
   23.84-
   23.85-        RewriteRule (.*) /home/uriel/cat-v.org/sites/%{HTTP_HOST}/$1
   23.86-
   23.87-        RewriteCond %{REQUEST_FILENAME} !-f
   23.88-        RewriteRule .* /home/uriel/cat-v.org/bin/werc.rc
   23.89-
   23.90-        RewriteRule /werc.rc /home/uriel/cat-v.org/bin/werc.rc
   23.91-        DocumentRoot /home/uriel/cat-v.org/bin/
   23.92-        ErrorDocument 404 /werc.rc
   23.93-
   23.94-    </VirtualHost>
   23.95-
    24.1--- a/sites/werc.cat-v.org/docs/web_server_setup/cherokee.md	Mon May 24 23:35:08 2010 +0000
    24.2+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.3@@ -1,31 +0,0 @@
    24.4-Configuring werc with Cherokee
    24.5-==============================
    24.6-
    24.7-Contributed by sqweek, thanks!
    24.8-
    24.9-Cherokee Version 0.7.1
   24.10-----------------------
   24.11-
   24.12-    vserver!default!rule!600!only_secure = 0
   24.13-    vserver!default!rule!600!handler = cgi
   24.14-    vserver!default!rule!600!handler!error_handler = 1
   24.15-    vserver!default!rule!600!handler!check_file = 1
   24.16-    vserver!default!rule!600!handler!script_alias =
   24.17-    /usr/local/werc/bin/werc.rc
   24.18-    vserver!default!rule!600!handler!pass_req_headers = 0
   24.19-    vserver!default!rule!600!match = directory
   24.20-    vserver!default!rule!600!match!directory = /code
   24.21-    vserver!default!rule!600!match!final = 1
   24.22-
   24.23-
   24.24-Cherokee Version 0.5.3
   24.25-----------------------
   24.26-
   24.27-    Directory /code {
   24.28-           Handler cgi {
   24.29-               Scriptalias /usr/local/werc/bin/werc.rc
   24.30-           }
   24.31-    }
   24.32-
   24.33-
   24.34-Isn't progress wonderful?
    25.1--- a/sites/werc.cat-v.org/docs/web_server_setup/hiawatha.md	Mon May 24 23:35:08 2010 +0000
    25.2+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.3@@ -1,16 +0,0 @@
    25.4-Hiawatha Web Server Configuration
    25.5----------------------------------
    25.6-
    25.7-Contributed by sqweek, thanks!
    25.8-
    25.9-This are the relevant bits:
   25.10-
   25.11-    CGIhandler = /usr/local/plan9/bin/rc:rc
   25.12-    ExecuteCGI = yes
   25.13-    RewriteURL = werc
   25.14-    UrlRewrite {
   25.15-        RewriteID = werc
   25.16-        Match ^(/code|/index|/contact|/clique).* Rewrite /werc.rc
   25.17-        Match ^/$ Rewrite /werc.rc
   25.18-    }
   25.19-
    26.1--- a/sites/werc.cat-v.org/docs/web_server_setup/lighttpd.md	Mon May 24 23:35:08 2010 +0000
    26.2+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.3@@ -1,44 +0,0 @@
    26.4-Setup werc with lighttpd
    26.5-========================
    26.6-
    26.7-You will need to enable to the following modules: `mod_cgi`, `mod_alias` and `mod_rewrite` (for non-minimal configurations).
    26.8-
    26.9-You can also find `mod_setenv` useful to change werc's environment ($PATH in perticular)
   26.10-
   26.11-Minimal setup
   26.12--------------
   26.13-This is the most minimal setup, for a single domain, and lets werc handle static files.
   26.14-
   26.15-    $HTTP["host"] =~ "^test\.cat-v\.org$" {
   26.16-        index-file.names = ( )
   26.17-        server.error-handler-404 = "/werc.rc"
   26.18-        alias.url       += ( "/werc.rc" => "/var/www/cat-v.org/bin/werc.rc" ) # Here use the path to werc.rc in your system.
   26.19-        cgi.assign += ( ".rc" => "")
   26.20-        server.dir-listing = "disable"
   26.21-    }
   26.22-
   26.23-Advanced setup
   26.24---------------
   26.25-
   26.26-A more ellaborate setup, using virtual hosts to handle multiple domains, and
   26.27-alias to let lighttpd handle static files.  Also show how to add external cgi's
   26.28-to the setup, in this case Mercurial's web interface.
   26.29-
   26.30-    $HTTP["host"] =~ "^((harmful|9p|gsoc|doc|uriel|src|repo|www|)(\.|)cat-v\.org|(www\.)?binarydream.org|)$" {
   26.31-
   26.32-        index-file.names = ( )
   26.33-        evhost.path-pattern     = "/var/www/cat-v.org/sites/%3.%0/"
   26.34-        server.error-handler-404 = "/werc.rc"
   26.35-
   26.36-        alias.url       += ( "/pub/" => "/var/www/cat-v.org/pub/" )
   26.37-        alias.url       += ( "/favicon.ico" => "/var/www/cat-v.org/pub/default_favicon.ico" )
   26.38-        alias.url       += ( "/doc/" => "/var/www/cat-v.org/sites/doc.cat-v.org/" )
   26.39-        alias.url       += ( "/werc.rc" => "/var/www/cat-v.org/bin/werc.rc" )
   26.40-        alias.url       += ( "/debug.rc" => "/var/www/cat-v.org/bin/debug.rc" )
   26.41-        cgi.assign += ( ".rc" => "")
   26.42-        server.dir-listing = "disable"
   26.43-
   26.44-        cgi.assign += ( ".cgi" => "")
   26.45-        url.rewrite-once = ( "/hg/(.*)" => "/hg/hgwebdir.cgi/$1" )
   26.46-        alias.url       += ( "/hg/" => "/var/www/cat-v.org/bin/"  )
   26.47-    }
    27.1--- a/sites/werc.cat-v.org/docs/web_server_setup/nginx.md	Mon May 24 23:35:08 2010 +0000
    27.2+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.3@@ -1,96 +0,0 @@
    27.4-Setup werc with NGINX
    27.5-=====================
    27.6-
    27.7-You probably will want to to use fcgiwrap, called from spawn-fcgi or similar.
    27.8-
    27.9-Here is an extremely basic nginx configuration, with this configuration static files will be handled by werc and not nginx, this is clearly dumb, but works:
   27.10-
   27.11-        worker_processes  1;
   27.12-
   27.13-        #error_log  logs/error.log;
   27.14-        #error_log  logs/error.log  notice;
   27.15-        error_log  logs/error.log  info;
   27.16-
   27.17-        pid        logs/nginx.pid;
   27.18-
   27.19-        events {
   27.20-            worker_connections  1024;
   27.21-        }
   27.22-
   27.23-
   27.24-        http {
   27.25-        include       mime.types;
   27.26-        default_type  application/octet-stream;
   27.27-
   27.28-        #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
   27.29-        #                  '$status $body_bytes_sent "$http_referer" '
   27.30-        #                  '"$http_user_agent" "$http_x_forwarded_for"';
   27.31-
   27.32-        #access_log  logs/access.log  main;
   27.33-
   27.34-        sendfile        on;
   27.35-        #tcp_nopush     on;
   27.36-
   27.37-        #keepalive_timeout  0;
   27.38-        keepalive_timeout  65;
   27.39-
   27.40-        #gzip  on;
   27.41-
   27.42-        server {
   27.43-            listen       80;
   27.44-            server_name  test.cat-v.org; # Replace with your domain name.
   27.45-
   27.46-            #charset utf-8;
   27.47-
   27.48-            #access_log  logs/host.access.log  main;
   27.49-
   27.50-            location / {
   27.51-
   27.52-            # FastCGI params, usually stored in fastcgi_params
   27.53-            # and imported with a command like the following:
   27.54-            #include        fastcgi_params;
   27.55-
   27.56-            # Typical contents of fastcgi_params (inlined here):
   27.57-            fastcgi_pass localhost:9000;
   27.58-
   27.59-            fastcgi_param  QUERY_STRING       $query_string;
   27.60-            fastcgi_param  REQUEST_METHOD     $request_method;
   27.61-            fastcgi_param  CONTENT_TYPE       $content_type;
   27.62-            fastcgi_param  CONTENT_LENGTH     $content_length;
   27.63-
   27.64-            #fastcgi_param  SCRIPT_FILENAME   /var/www/werc/bin/werc.rc;
   27.65-            fastcgi_param  SCRIPT_NAME        /var/www/werc/bin/werc.rc;
   27.66-            #fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
   27.67-
   27.68-            fastcgi_param  REQUEST_URI        $request_uri;
   27.69-            fastcgi_param  DOCUMENT_URI       $document_uri;
   27.70-            fastcgi_param  DOCUMENT_ROOT      $document_root;
   27.71-            fastcgi_param  SERVER_PROTOCOL    $server_protocol;
   27.72-
   27.73-            fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
   27.74-            fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;
   27.75-
   27.76-            fastcgi_param  REMOTE_ADDR        $remote_addr;
   27.77-            fastcgi_param  REMOTE_PORT        $remote_port;
   27.78-            fastcgi_param  SERVER_ADDR        $server_addr;
   27.79-            fastcgi_param  SERVER_PORT        $server_port;
   27.80-            fastcgi_param  SERVER_NAME        $server_name;
   27.81-            fastcgi_param  REMOTE_USER        $remote_user;
   27.82-
   27.83-            #root   /var/www/werc/sites/$server_addr; # XXX This doesn't work, not sure why :(
   27.84-            root /;
   27.85-            #index  index.html index.htm;
   27.86-            }
   27.87-        }
   27.88-    }
   27.89-
   27.90-
   27.91-Then you can use spawn-fcgi or similar to get wrapcgi going:
   27.92-
   27.93-	spawn-fcgi -a 127.0.0.1 -p 9000 -f /home/uriel/dvl/ext/fcgiwrap/fcgiwrap # Use the path to your fcgiwrap binary here
   27.94-
   27.95-
   27.96-Other Setups
   27.97-------------
   27.98-
   27.99-More elaborate setups with direct handling of static files, caching, and multiple fcgi/cgi handlers should be easy, if you have any please post them to the werc9 mailing list.
    28.1--- a/sites/werc.cat-v.org/docs/web_server_setup/nhttpd.md	Mon May 24 23:35:08 2010 +0000
    28.2+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.3@@ -1,60 +0,0 @@
    28.4-Nhttpd/Nostromo  Web Server Configuration for Werc
    28.5-==================================================
    28.6-
    28.7-Contributed by nsz, thanks!
    28.8-
    28.9-The last two sections are relevant: aliases (to make non-content site material,
   28.10-like css, available) and virtual hosts (the document root is set to `werc.rc`
   28.11-so it will handle every request).
   28.12-
   28.13-    # MAIN [MANDATORY]
   28.14-    
   28.15-    servername      main.host.com
   28.16-    serveradmin     admin[at]mail.com
   28.17-    serverroot      /var/nostromo
   28.18-    servermimes     conf/mimes
   28.19-    logpid          logs/nhttpd.pid
   28.20-    logaccess       logs/access_log
   28.21-    docroot         /var/nostromo/htdocs
   28.22-    docindex        index.html
   28.23-    
   28.24-    # SETUID [RECOMMENDED]
   28.25-    
   28.26-    user            nhttpd
   28.27-    
   28.28-    # BASIC AUTHENTICATION [OPTIONAL]
   28.29-    #...
   28.30-    
   28.31-    # SSL [OPTIONAL]
   28.32-    #...
   28.33-    
   28.34-    # CUSTOM RESPONSES [OPTIONAL]
   28.35-    #...
   28.36-    
   28.37-    # HOMEDIRS [OPTIONAL]
   28.38-    #...
   28.39-    
   28.40-    # ALIASES [OPTIONAL]
   28.41-    
   28.42-    /pub            /path/to/werc/pub
   28.43-    # The following line doesn't work because nhttpd doesn't support file aliases yet.
   28.44-    #/favicon.ico        /path/to/werc/pub/default_favicon.ico
   28.45-    
   28.46-    # VIRTUAL HOSTS [OPTIONAL]
   28.47-    
   28.48-    vhost1.com      /path/to/werc/bin/werc.rc
   28.49-    vhost2.com      /path/to/werc/bin/werc.rc
   28.50-    #...
   28.51-
   28.52-To use werc on `main.host.com` as well just set `docroot` to `/path/to/werc/bin/werc.rc`
   28.53-and set `docindex` to empty string.
   28.54-
   28.55-There was a bug in nhttpd <=1.9, it did not set `SERVER_NAME` properly (left it `main.host.com`).
   28.56-To solve this problem just add a
   28.57-
   28.58-    SERVER_NAME=$HTTP_HOST
   28.59-
   28.60-line somewhere at the top of `werc.rc`.
   28.61-
   28.62-
   28.63-
    29.1--- a/sites/werc.cat-v.org/docs/web_server_setup/plan_9_httpd.md	Mon May 24 23:35:08 2010 +0000
    29.2+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.3@@ -1,53 +0,0 @@
    29.4-Setup werc with Plan 9's httpd
    29.5-==============================
    29.6-
    29.7-
    29.8-There are two main options, you can use Russ Cox's magic to cgi translator
    29.9-(found in his contrib dir as cgi.c), or you can use the following script which
   29.10-while simpler, it also lacks some features at the moment.
   29.11-
   29.12-Thanks to soul9 for the original idea of wrapping werc in a shell script that
   29.13-would setup a cgi-like environment!
   29.14-
   29.15-
   29.16-    #!/bin/rc
   29.17-
   29.18-    SERVER_NAME=$2
   29.19-    REQUEST_URI=`{echo $*(15)}
   29.20-    REQUEST_URI=$REQUEST_URI(2)
   29.21-    REQUEST_URI=/
   29.22-    REQUEST_METHOD=$*(16)
   29.23-    PLAN9=/
   29.24-
   29.25-
   29.26-    echo 'HTTP/1.0 200 Ok
   29.27-    Connection: close
   29.28-    Server: werc/9.9.9' # This is whatever you like
   29.29-
   29.30-
   29.31-    cd /usr/web/bin/
   29.32-    rfork
   29.33-    /bin/rc < ./werc.rc >[2]/usr/glenda/tmp/w/log # Use whatever location you like to log stderr, but make sure it is writable by none.
   29.34-
   29.35-Call this script werc-wrap, and put it in /rc/bin/ip/httpd/
   29.36-
   29.37-Then in your /sys/lib/httpd.rewrite  add a line like:
   29.38-
   29.39-    /w @/magic/werc-wrap
   29.40-
   29.41-And this will run werc for all stuff under /w. Note that apparently httpd is
   29.42-incapable of internally remapping the root directory, so until a solution is
   29.43-found for this, you will have to keep your site in a sub-directory of the web
   29.44-server root.
   29.45-
   29.46-In your /lib/namespace.httpd you probably will want to add something along the
   29.47-following lines to bind the werc directory into the httpd's namespace:
   29.48-
   29.49-    bind -b /usr/glenda/src/werc/ /usr/web/
   29.50-    bind /usr/glenda/src/werc/bin/ /usr/web/magic/
   29.51-
   29.52-
   29.53-**Notes**: This is experimental and work in progress, there are a couple of issues
   29.54-with the werc code itself that might need fixing, in particular you will need
   29.55-to replace the '%($"extraHeaders%)' in lib/headers.tpl with '% echo
   29.56-$"extraHeaders' no clue why.