ref: e41deb9b834d13e2f38ca14177bb0380091ad794
parent: 45a78e7bc3452aee2010fde364626a97797e6640
author: Uriel <u@berlinblue.org>
date: Sun May 30 14:04:04 EDT 2010
Replace '_' in paths in werc's docs section with '-', and set up apropriate redirects to avoid broken links.
--- /dev/null
+++ b/sites/werc.cat-v.org/docs/_werc/config
@@ -1,0 +1,1 @@
+conf_perm_redirect _ -
--- /dev/null
+++ b/sites/werc.cat-v.org/docs/config-options.md
@@ -1,0 +1,60 @@
+Werc Configuration Options
+==========================
+
+You can also find a description of some basic config options in the `etc/initrc` file itself.
+
+General Setup Options
+--------------------
+
+* `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)`
+
+
+Titles and Metadata
+-------------------
+
+Variables:
+
+* Page title:
+ * siteTitle
+ * siteSubTitle
+
+* Html header meta tags:
+ * meta_description - `<meta name="description" ...`
+ * meta_keywords - `<meta name="keywords" ...`
+ * extraHeaders - Raw extra html headers, the content of this var will be inserted inside the `<head>` tag..
+
+
+Sidebar and Navigation
+----------------------
+
+Variables:
+
+* sideBarNavTitle
+
+Functions:
+
+* `conf_hide_paths [path_patterns ...]` - Hide the given patterns from navigation menu, sitemap and dir listing (do *not* depend on this for security!).
+
+HTTP Control
+------------
+
+Variables:
+
+* extraHttpHeaders - Raw HTTP headers to be added to response.
+
+Functions:
+
+* `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/.
+
+
+Access Control and Permissions
+------------------------------
+
+The permissions system is very flexible, for example to only allow access to members of the group 'editors' you can do something like:
+
+ if(! check_user editors)
+ perm_redirect /_users/login
+
+To automatically redirect users without permission to the login page if they are not members of the group 'editors'.
+
+See also [the documentation on user and group management](user_management).
--- a/sites/werc.cat-v.org/docs/config_options.md
+++ /dev/null
@@ -1,60 +1,0 @@
-Werc Configuration Options
-==========================
-
-You can also find a description of some basic config options in the `etc/initrc` file itself.
-
-General Setup Options
---------------------
-
-* `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)`
-
-
-Titles and Metadata
--------------------
-
-Variables:
-
-* Page title:
- * siteTitle
- * siteSubTitle
-
-* Html header meta tags:
- * meta_description - `<meta name="description" ...`
- * meta_keywords - `<meta name="keywords" ...`
- * extraHeaders - Raw extra html headers, the content of this var will be inserted inside the `<head>` tag..
-
-
-Sidebar and Navigation
-----------------------
-
-Variables:
-
-* sideBarNavTitle
-
-Functions:
-
-* `conf_hide_paths [path_patterns ...]` - Hide the given patterns from navigation menu, sitemap and dir listing (do *not* depend on this for security!).
-
-HTTP Control
-------------
-
-Variables:
-
-* extraHttpHeaders - Raw HTTP headers to be added to response.
-
-Functions:
-
-* `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/.
-
-
-Access Control and Permissions
-------------------------------
-
-The permissions system is very flexible, for example to only allow access to members of the group 'editors' you can do something like:
-
- if(! check_user editors)
- perm_redirect /_users/login
-
-To automatically redirect users without permission to the login page if they are not members of the group 'editors'.
-
-See also [the documentation on user and group management](user_management).
--- /dev/null
+++ b/sites/werc.cat-v.org/docs/css-style.md
@@ -1,0 +1,18 @@
+Custom CSS Stylesheets
+=====================
+
+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.
+
+You can copy pub/style/style.css and customize it, or you can take a simpler file and just change the main color theme.
+
+Here is an example of how to set the main werc colors:
+
+
+ body { background-color: #FFFFF7; }
+ .midHeader { background-color: #FFFFE9; }
+ #side-bar { background-color: #EFFFEF; }
+ #side-bar a { color: black; }
+ #side-bar a:hover {
+ color: white!important;
+ background-color: #428a42;
+ }
--- a/sites/werc.cat-v.org/docs/css_style.md
+++ /dev/null
@@ -1,18 +1,0 @@
-Custom CSS Stylesheets
-=====================
-
-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.
-
-You can copy pub/style/style.css and customize it, or you can take a simpler file and just change the main color theme.
-
-Here is an example of how to set the main werc colors:
-
-
- body { background-color: #FFFFF7; }
- .midHeader { background-color: #FFFFE9; }
- #side-bar { background-color: #EFFFEF; }
- #side-bar a { color: black; }
- #side-bar a:hover {
- color: white!important;
- background-color: #428a42;
- }
--- /dev/null
+++ b/sites/werc.cat-v.org/docs/dir-listings.md
@@ -1,0 +1,29 @@
+Autogenerated Directory Listings
+================================
+
+If a directory has no `index.md`, `index.html` or `index.txt` and has no other
+*main handler* set up by a [werc app](/apps/), the default directory listing
+handler is used.
+
+The default directory handler simply displays the path to the directory, and a
+list of links to all files and dirs located at this path.
+
+
+Header and footer
+-----------------
+
+If a `_header.md` or `_footer.md` files are found in the directory, their
+contents will be displayed in the corresponding sections before and after
+the directory contents.
+
+
+Tuning the item's order
+------------------------
+
+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.
+
+For example to list items in reverse chronological order simply add:
+
+ dir_listing_ls_opts=( -t )
+
+The options taken are [the standard Plan 9 ls(1) flags](http://man.cat-v.org/plan_9/1/ls).
--- a/sites/werc.cat-v.org/docs/dir_listings.md
+++ /dev/null
@@ -1,29 +1,0 @@
-Autogenerated Directory Listings
-================================
-
-If a directory has no `index.md`, `index.html` or `index.txt` and has no other
-*main handler* set up by a [werc app](/apps/), the default directory listing
-handler is used.
-
-The default directory handler simply displays the path to the directory, and a
-list of links to all files and dirs located at this path.
-
-
-Header and footer
------------------
-
-If a `_header.md` or `_footer.md` files are found in the directory, their
-contents will be displayed in the corresponding sections before and after
-the directory contents.
-
-
-Tuning the item's order
-------------------------
-
-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.
-
-For example to list items in reverse chronological order simply add:
-
- dir_listing_ls_opts=( -t )
-
-The options taken are [the standard Plan 9 ls(1) flags](http://man.cat-v.org/plan_9/1/ls).
--- /dev/null
+++ b/sites/werc.cat-v.org/docs/rc-template-lang.md
@@ -1,0 +1,46 @@
+The Rc Template Language
+========================
+
+Implemented by Kris, thanks!
+
+Basic syntax:
+
+* Lines starting with % are executed as rc commands, the resulting output is inserted in the document.
+* use %{ and %} to delimit multi line sections of rc code (note the lack of space between % and { or }!
+* To 'inline' the value of an environment variable use `%($my_var%)`
+
+That is basically it!
+
+For further documentation on rc see:
+
+* [The rc(1) man page for Plan 9](http://man.cat-v.org/plan_9/1/rc).
+* [The rc shell paper by Tom Duff](http://rc.cat-v.org).
+
+
+Examples
+--------
+
+Loops
+
+ <ul>
+ % for(i in a b c) {
+ % echo '<li>'$i'</li>'
+ % }
+ </uL>
+
+Is equivalent to:
+
+ <ul>
+ % for(i in a b c) {
+ <li>%($i%)</li>
+ % }
+ </uL>
+
+and results in this output:
+
+ <ul>
+ <li>a</li>
+ <li>b</li>
+ <li>c</li>
+ </ul>
+
--- a/sites/werc.cat-v.org/docs/rc_template_lang.md
+++ /dev/null
@@ -1,46 +1,0 @@
-The Rc Template Language
-========================
-
-Implemented by Kris, thanks!
-
-Basic syntax:
-
-* Lines starting with % are executed as rc commands, the resulting output is inserted in the document.
-* use %{ and %} to delimit multi line sections of rc code (note the lack of space between % and { or }!
-* To 'inline' the value of an environment variable use `%($my_var%)`
-
-That is basically it!
-
-For further documentation on rc see:
-
-* [The rc(1) man page for Plan 9](http://man.cat-v.org/plan_9/1/rc).
-* [The rc shell paper by Tom Duff](http://rc.cat-v.org).
-
-
-Examples
---------
-
-Loops
-
- <ul>
- % for(i in a b c) {
- % echo '<li>'$i'</li>'
- % }
- </uL>
-
-Is equivalent to:
-
- <ul>
- % for(i in a b c) {
- <li>%($i%)</li>
- % }
- </uL>
-
-and results in this output:
-
- <ul>
- <li>a</li>
- <li>b</li>
- <li>c</li>
- </ul>
-
--- /dev/null
+++ b/sites/werc.cat-v.org/docs/site-customization.md
@@ -1,0 +1,50 @@
+Site Customization
+==================
+
+To change any of the default templates and include files simply copy them
+from /lib/ to your site's _werc/lib/ and edit at will.
+
+File Types
+----------
+
+* '.tpl' files are rc [template files](rc_template_lang).
+* '.inc' are text files that are inserted 'as is' without any extra processing.
+
+Site Groups
+-----------
+
+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).
+
+Simply set 'masterSite' configuration variable to the name of the site you want to 'inherit' templates, style and configuration from.
+
+For example, if we have two sites bar.com and foo.bar.com, and in sites/foo.bar.com/_werc/conf we add:
+
+ masterSite=bar.com
+
+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.
+
+The same applies to .inc files.
+
+
+List of Template and Included Files
+-----------------------------------
+
+Here is a list of the most commonly used templates and include files with their corresponding descriptions.
+
+Include:
+
+* 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.
+* footer.inc: Similar but at the bottom of every page, by default includes a link to the user login page.
+* headers.inc: Raw html headers to be included inside <head> tag.
+
+Templates:
+
+* 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.
+* sitemap.tpl: Template for the sitemap page.
+* 404.tpl: Template for 'File Not Found' pages.
+
+
+See also
+--------
+
+* [CSS style sheets customization](css_style).
--- a/sites/werc.cat-v.org/docs/site_customization.md
+++ /dev/null
@@ -1,50 +1,0 @@
-Site Customization
-==================
-
-To change any of the default templates and include files simply copy them
-from /lib/ to your site's _werc/lib/ and edit at will.
-
-File Types
-----------
-
-* '.tpl' files are rc [template files](rc_template_lang).
-* '.inc' are text files that are inserted 'as is' without any extra processing.
-
-Site Groups
------------
-
-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).
-
-Simply set 'masterSite' configuration variable to the name of the site you want to 'inherit' templates, style and configuration from.
-
-For example, if we have two sites bar.com and foo.bar.com, and in sites/foo.bar.com/_werc/conf we add:
-
- masterSite=bar.com
-
-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.
-
-The same applies to .inc files.
-
-
-List of Template and Included Files
------------------------------------
-
-Here is a list of the most commonly used templates and include files with their corresponding descriptions.
-
-Include:
-
-* 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.
-* footer.inc: Similar but at the bottom of every page, by default includes a link to the user login page.
-* headers.inc: Raw html headers to be included inside <head> tag.
-
-Templates:
-
-* 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.
-* sitemap.tpl: Template for the sitemap page.
-* 404.tpl: Template for 'File Not Found' pages.
-
-
-See also
---------
-
-* [CSS style sheets customization](css_style).
--- /dev/null
+++ b/sites/werc.cat-v.org/docs/user-management.md
@@ -1,0 +1,36 @@
+User and Group Management
+=========================
+
+User account and group membership information are stored under `etc/users/`.
+
+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:
+
+ % ls etc/users/
+ eekee uriel yosyp
+ % cat etc/users/uriel/password
+ mypass
+
+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.
+
+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.
+
+The group 'admin' is 'built-in' and any members in that group will have admin privileges for most werc apps by default.
+
+Example
+-------
+
+To create a user called [glenda](http://glenda.cat-v.org) that is a member of the group `rabbits` you can do:
+
+ % mkdir etc/users/glenda/
+ % echo carrot > etc/users/glenda/password
+ % mkdir -p etc/users/rabbits
+ % echo glenda >> etc/users/rabbits/members
+
+Utils
+-----
+
+The script at bin/aux/addwuser.rc allows you to even more trivially add users.
+
+ addwuser.rc user_name user_pass [groups ...]
+
+
--- a/sites/werc.cat-v.org/docs/user_management.md
+++ /dev/null
@@ -1,36 +1,0 @@
-User and Group Management
-=========================
-
-User account and group membership information are stored under `etc/users/`.
-
-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:
-
- % ls etc/users/
- eekee uriel yosyp
- % cat etc/users/uriel/password
- mypass
-
-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.
-
-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.
-
-The group 'admin' is 'built-in' and any members in that group will have admin privileges for most werc apps by default.
-
-Example
--------
-
-To create a user called [glenda](http://glenda.cat-v.org) that is a member of the group `rabbits` you can do:
-
- % mkdir etc/users/glenda/
- % echo carrot > etc/users/glenda/password
- % mkdir -p etc/users/rabbits
- % echo glenda >> etc/users/rabbits/members
-
-Utils
------
-
-The script at bin/aux/addwuser.rc allows you to even more trivially add users.
-
- addwuser.rc user_name user_pass [groups ...]
-
-
--- /dev/null
+++ b/sites/werc.cat-v.org/docs/web-server-setup/_header.md
@@ -1,0 +1,16 @@
+Setting Up Your HTTP Server to Run Werc
+=======================================
+
+
+Werc should work with any web server that supports the CGI interface, and a few
+that don't. Here are collected instructions and sample configurations for some
+of the most popular HTTP servers that people has used with werc.
+
+In general setup consists of mapping all paths for a virtual host to the
+werc.rc script, usually in practice this means that the `document root` (or
+similar concept) for a virtual host is mapped to
+`/path/to/werc/sites/domain.name.com/`, and if no static file matches the
+request, control is handed to werc.rc, this allows the HTTP server to handle
+static files and werc to handle everything else (note that such a setup will
+expose your `_werc/config` files, which usually should not be a security
+issue).
--- /dev/null
+++ b/sites/werc.cat-v.org/docs/web-server-setup/apache.md
@@ -1,0 +1,92 @@
+Setup werc with Apache
+======================
+
+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.
+
+Apache 1.3.x: minimalist configuration
+======================================
+
+No virtual hosts and let werc handle static files.
+
+ RewriteEngine On
+ ServerName test.cat-v.org
+ AddHandler cgi-script .rc
+
+ <Directory /var/www/werc/bin>
+ Options ExecCGI
+ </Directory>
+ <IfModule mod_dir.c>
+ DirectoryIndex /werc.rc
+ </IfModule>
+
+ RewriteRule /werc.rc /var/www/werc/bin/werc.rc
+ DocumentRoot /var/www/werc/bin/
+ ErrorDocument 404 /werc.rc
+
+
+Apache 1.3.x: standard configuration
+====================================
+
+This lets apache handle static files.
+
+ <VirtualHost *>
+
+ RewriteEngine On
+ ServerName test.cat-v.org
+ AddHandler cgi-script .rc
+
+ <Directory /var/wwww/werc/bin>
+ Options ExecCGI
+ </Directory>
+ <IfModule mod_dir.c>
+ DirectoryIndex /werc.rc
+ </IfModule>
+
+ RewriteRule (.*) /var/www/werc/sites/%{HTTP_HOST}/$1
+
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteRule .* /var/www/werc/bin/werc.rc
+
+ RewriteRule /werc.rc /var/www/werc/bin/werc.rc
+ DocumentRoot /var/www/werc/bin/
+ ErrorDocument 404 /werc.rc
+
+ </VirtualHost>
+
+
+Apache 1.3.x: advanced configuration
+====================================
+
+
+ <VirtualHost *>
+
+ RewriteEngine On
+ ServerName cat-v.org
+ 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
+ AddHandler cgi-script .rc
+ AddHandler cgi-script .cgi
+ <Directory /home/uriel/cat-v.org/bin>
+ Options ExecCGI
+ </Directory>
+ <IfModule mod_dir.c>
+ DirectoryIndex /werc.rc
+ </IfModule>
+
+ RewriteRule ^/hg/(.*) /home/uriel/cat-v.org/bin/hgwebdir.cgi/$1 [L]
+
+ RewriteRule /pub/style/style.css /home/uriel/cat-v.org/pub/style/style.css [L]
+ RewriteRule /pub/ /home/uriel/cat-v.org/pub/ [L]
+ RewriteRule /favicon.ico /home/uriel/cat-v.org/pub/default_favicon.ico [L]
+
+
+ RewriteRule (.*) /home/uriel/cat-v.org/sites/%{HTTP_HOST}/$1
+
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteRule .* /home/uriel/cat-v.org/bin/werc.rc
+
+ RewriteRule /werc.rc /home/uriel/cat-v.org/bin/werc.rc
+ DocumentRoot /home/uriel/cat-v.org/bin/
+ ErrorDocument 404 /werc.rc
+
+ </VirtualHost>
+
--- /dev/null
+++ b/sites/werc.cat-v.org/docs/web-server-setup/cherokee.md
@@ -1,0 +1,31 @@
+Configuring werc with Cherokee
+==============================
+
+Contributed by sqweek, thanks!
+
+Cherokee Version 0.7.1
+----------------------
+
+ vserver!default!rule!600!only_secure = 0
+ vserver!default!rule!600!handler = cgi
+ vserver!default!rule!600!handler!error_handler = 1
+ vserver!default!rule!600!handler!check_file = 1
+ vserver!default!rule!600!handler!script_alias =
+ /usr/local/werc/bin/werc.rc
+ vserver!default!rule!600!handler!pass_req_headers = 0
+ vserver!default!rule!600!match = directory
+ vserver!default!rule!600!match!directory = /code
+ vserver!default!rule!600!match!final = 1
+
+
+Cherokee Version 0.5.3
+----------------------
+
+ Directory /code {
+ Handler cgi {
+ Scriptalias /usr/local/werc/bin/werc.rc
+ }
+ }
+
+
+Isn't progress wonderful?
--- /dev/null
+++ b/sites/werc.cat-v.org/docs/web-server-setup/hiawatha.md
@@ -1,0 +1,16 @@
+Hiawatha Web Server Configuration
+---------------------------------
+
+Contributed by sqweek, thanks!
+
+This are the relevant bits:
+
+ CGIhandler = /usr/local/plan9/bin/rc:rc
+ ExecuteCGI = yes
+ RewriteURL = werc
+ UrlRewrite {
+ RewriteID = werc
+ Match ^(/code|/index|/contact|/clique).* Rewrite /werc.rc
+ Match ^/$ Rewrite /werc.rc
+ }
+
--- /dev/null
+++ b/sites/werc.cat-v.org/docs/web-server-setup/lighttpd.md
@@ -1,0 +1,44 @@
+Setup werc with lighttpd
+========================
+
+You will need to enable to the following modules: `mod_cgi`, `mod_alias` and `mod_rewrite` (for non-minimal configurations).
+
+You can also find `mod_setenv` useful to change werc's environment ($PATH in perticular)
+
+Minimal setup
+-------------
+This is the most minimal setup, for a single domain, and lets werc handle static files.
+
+ $HTTP["host"] =~ "^test\.cat-v\.org$" {
+ index-file.names = ( )
+ server.error-handler-404 = "/werc.rc"
+ alias.url += ( "/werc.rc" => "/var/www/cat-v.org/bin/werc.rc" ) # Here use the path to werc.rc in your system.
+ cgi.assign += ( ".rc" => "")
+ server.dir-listing = "disable"
+ }
+
+Advanced setup
+--------------
+
+A more ellaborate setup, using virtual hosts to handle multiple domains, and
+alias to let lighttpd handle static files. Also show how to add external cgi's
+to the setup, in this case Mercurial's web interface.
+
+ $HTTP["host"] =~ "^((harmful|9p|gsoc|doc|uriel|src|repo|www|)(\.|)cat-v\.org|(www\.)?binarydream.org|)$" {
+
+ index-file.names = ( )
+ evhost.path-pattern = "/var/www/cat-v.org/sites/%3.%0/"
+ server.error-handler-404 = "/werc.rc"
+
+ alias.url += ( "/pub/" => "/var/www/cat-v.org/pub/" )
+ alias.url += ( "/favicon.ico" => "/var/www/cat-v.org/pub/default_favicon.ico" )
+ alias.url += ( "/doc/" => "/var/www/cat-v.org/sites/doc.cat-v.org/" )
+ alias.url += ( "/werc.rc" => "/var/www/cat-v.org/bin/werc.rc" )
+ alias.url += ( "/debug.rc" => "/var/www/cat-v.org/bin/debug.rc" )
+ cgi.assign += ( ".rc" => "")
+ server.dir-listing = "disable"
+
+ cgi.assign += ( ".cgi" => "")
+ url.rewrite-once = ( "/hg/(.*)" => "/hg/hgwebdir.cgi/$1" )
+ alias.url += ( "/hg/" => "/var/www/cat-v.org/bin/" )
+ }
--- /dev/null
+++ b/sites/werc.cat-v.org/docs/web-server-setup/nginx.md
@@ -1,0 +1,96 @@
+Setup werc with NGINX
+=====================
+
+You probably will want to to use fcgiwrap, called from spawn-fcgi or similar.
+
+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:
+
+ worker_processes 1;
+
+ #error_log logs/error.log;
+ #error_log logs/error.log notice;
+ error_log logs/error.log info;
+
+ pid logs/nginx.pid;
+
+ events {
+ worker_connections 1024;
+ }
+
+
+ http {
+ include mime.types;
+ default_type application/octet-stream;
+
+ #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
+ # '$status $body_bytes_sent "$http_referer" '
+ # '"$http_user_agent" "$http_x_forwarded_for"';
+
+ #access_log logs/access.log main;
+
+ sendfile on;
+ #tcp_nopush on;
+
+ #keepalive_timeout 0;
+ keepalive_timeout 65;
+
+ #gzip on;
+
+ server {
+ listen 80;
+ server_name test.cat-v.org; # Replace with your domain name.
+
+ #charset utf-8;
+
+ #access_log logs/host.access.log main;
+
+ location / {
+
+ # FastCGI params, usually stored in fastcgi_params
+ # and imported with a command like the following:
+ #include fastcgi_params;
+
+ # Typical contents of fastcgi_params (inlined here):
+ fastcgi_pass localhost:9000;
+
+ fastcgi_param QUERY_STRING $query_string;
+ fastcgi_param REQUEST_METHOD $request_method;
+ fastcgi_param CONTENT_TYPE $content_type;
+ fastcgi_param CONTENT_LENGTH $content_length;
+
+ #fastcgi_param SCRIPT_FILENAME /var/www/werc/bin/werc.rc;
+ fastcgi_param SCRIPT_NAME /var/www/werc/bin/werc.rc;
+ #fastcgi_param SCRIPT_NAME $fastcgi_script_name;
+
+ fastcgi_param REQUEST_URI $request_uri;
+ fastcgi_param DOCUMENT_URI $document_uri;
+ fastcgi_param DOCUMENT_ROOT $document_root;
+ fastcgi_param SERVER_PROTOCOL $server_protocol;
+
+ fastcgi_param GATEWAY_INTERFACE CGI/1.1;
+ fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
+
+ fastcgi_param REMOTE_ADDR $remote_addr;
+ fastcgi_param REMOTE_PORT $remote_port;
+ fastcgi_param SERVER_ADDR $server_addr;
+ fastcgi_param SERVER_PORT $server_port;
+ fastcgi_param SERVER_NAME $server_name;
+ fastcgi_param REMOTE_USER $remote_user;
+
+ #root /var/www/werc/sites/$server_addr; # XXX This doesn't work, not sure why :(
+ root /;
+ #index index.html index.htm;
+ }
+ }
+ }
+
+
+Then you can use spawn-fcgi or similar to get wrapcgi going:
+
+ spawn-fcgi -a 127.0.0.1 -p 9000 -f /home/uriel/dvl/ext/fcgiwrap/fcgiwrap # Use the path to your fcgiwrap binary here
+
+
+Other Setups
+------------
+
+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.
--- /dev/null
+++ b/sites/werc.cat-v.org/docs/web-server-setup/nhttpd.md
@@ -1,0 +1,60 @@
+Nhttpd/Nostromo Web Server Configuration for Werc
+==================================================
+
+Contributed by nsz, thanks!
+
+The last two sections are relevant: aliases (to make non-content site material,
+like css, available) and virtual hosts (the document root is set to `werc.rc`
+so it will handle every request).
+
+ # MAIN [MANDATORY]
+
+ servername main.host.com
+ serveradmin admin[at]mail.com
+ serverroot /var/nostromo
+ servermimes conf/mimes
+ logpid logs/nhttpd.pid
+ logaccess logs/access_log
+ docroot /var/nostromo/htdocs
+ docindex index.html
+
+ # SETUID [RECOMMENDED]
+
+ user nhttpd
+
+ # BASIC AUTHENTICATION [OPTIONAL]
+ #...
+
+ # SSL [OPTIONAL]
+ #...
+
+ # CUSTOM RESPONSES [OPTIONAL]
+ #...
+
+ # HOMEDIRS [OPTIONAL]
+ #...
+
+ # ALIASES [OPTIONAL]
+
+ /pub /path/to/werc/pub
+ # The following line doesn't work because nhttpd doesn't support file aliases yet.
+ #/favicon.ico /path/to/werc/pub/default_favicon.ico
+
+ # VIRTUAL HOSTS [OPTIONAL]
+
+ vhost1.com /path/to/werc/bin/werc.rc
+ vhost2.com /path/to/werc/bin/werc.rc
+ #...
+
+To use werc on `main.host.com` as well just set `docroot` to `/path/to/werc/bin/werc.rc`
+and set `docindex` to empty string.
+
+There was a bug in nhttpd <=1.9, it did not set `SERVER_NAME` properly (left it `main.host.com`).
+To solve this problem just add a
+
+ SERVER_NAME=$HTTP_HOST
+
+line somewhere at the top of `werc.rc`.
+
+
+
--- /dev/null
+++ b/sites/werc.cat-v.org/docs/web-server-setup/plan-9-httpd.md
@@ -1,0 +1,53 @@
+Setup werc with Plan 9's httpd
+==============================
+
+
+There are two main options, you can use Russ Cox's magic to cgi translator
+(found in his contrib dir as cgi.c), or you can use the following script which
+while simpler, it also lacks some features at the moment.
+
+Thanks to soul9 for the original idea of wrapping werc in a shell script that
+would setup a cgi-like environment!
+
+
+ #!/bin/rc
+
+ SERVER_NAME=$2
+ REQUEST_URI=`{echo $*(15)}
+ REQUEST_URI=$REQUEST_URI(2)
+ REQUEST_URI=/
+ REQUEST_METHOD=$*(16)
+ PLAN9=/
+
+
+ echo 'HTTP/1.0 200 Ok
+ Connection: close
+ Server: werc/9.9.9' # This is whatever you like
+
+
+ cd /usr/web/bin/
+ rfork
+ /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.
+
+Call this script werc-wrap, and put it in /rc/bin/ip/httpd/
+
+Then in your /sys/lib/httpd.rewrite add a line like:
+
+ /w @/magic/werc-wrap
+
+And this will run werc for all stuff under /w. Note that apparently httpd is
+incapable of internally remapping the root directory, so until a solution is
+found for this, you will have to keep your site in a sub-directory of the web
+server root.
+
+In your /lib/namespace.httpd you probably will want to add something along the
+following lines to bind the werc directory into the httpd's namespace:
+
+ bind -b /usr/glenda/src/werc/ /usr/web/
+ bind /usr/glenda/src/werc/bin/ /usr/web/magic/
+
+
+**Notes**: This is experimental and work in progress, there are a couple of issues
+with the werc code itself that might need fixing, in particular you will need
+to replace the '%($"extraHeaders%)' in lib/headers.tpl with '% echo
+$"extraHeaders' no clue why.
--- a/sites/werc.cat-v.org/docs/web_server_setup/_header.md
+++ /dev/null
@@ -1,16 +1,0 @@
-Setting Up Your HTTP Server to Run Werc
-=======================================
-
-
-Werc should work with any web server that supports the CGI interface, and a few
-that don't. Here are collected instructions and sample configurations for some
-of the most popular HTTP servers that people has used with werc.
-
-In general setup consists of mapping all paths for a virtual host to the
-werc.rc script, usually in practice this means that the `document root` (or
-similar concept) for a virtual host is mapped to
-`/path/to/werc/sites/domain.name.com/`, and if no static file matches the
-request, control is handed to werc.rc, this allows the HTTP server to handle
-static files and werc to handle everything else (note that such a setup will
-expose your `_werc/config` files, which usually should not be a security
-issue).
--- a/sites/werc.cat-v.org/docs/web_server_setup/apache.md
+++ /dev/null
@@ -1,92 +1,0 @@
-Setup werc with Apache
-======================
-
-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.
-
-Apache 1.3.x: minimalist configuration
-======================================
-
-No virtual hosts and let werc handle static files.
-
- RewriteEngine On
- ServerName test.cat-v.org
- AddHandler cgi-script .rc
-
- <Directory /var/www/werc/bin>
- Options ExecCGI
- </Directory>
- <IfModule mod_dir.c>
- DirectoryIndex /werc.rc
- </IfModule>
-
- RewriteRule /werc.rc /var/www/werc/bin/werc.rc
- DocumentRoot /var/www/werc/bin/
- ErrorDocument 404 /werc.rc
-
-
-Apache 1.3.x: standard configuration
-====================================
-
-This lets apache handle static files.
-
- <VirtualHost *>
-
- RewriteEngine On
- ServerName test.cat-v.org
- AddHandler cgi-script .rc
-
- <Directory /var/wwww/werc/bin>
- Options ExecCGI
- </Directory>
- <IfModule mod_dir.c>
- DirectoryIndex /werc.rc
- </IfModule>
-
- RewriteRule (.*) /var/www/werc/sites/%{HTTP_HOST}/$1
-
- RewriteCond %{REQUEST_FILENAME} !-f
- RewriteRule .* /var/www/werc/bin/werc.rc
-
- RewriteRule /werc.rc /var/www/werc/bin/werc.rc
- DocumentRoot /var/www/werc/bin/
- ErrorDocument 404 /werc.rc
-
- </VirtualHost>
-
-
-Apache 1.3.x: advanced configuration
-====================================
-
-
- <VirtualHost *>
-
- RewriteEngine On
- ServerName cat-v.org
- 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
- AddHandler cgi-script .rc
- AddHandler cgi-script .cgi
- <Directory /home/uriel/cat-v.org/bin>
- Options ExecCGI
- </Directory>
- <IfModule mod_dir.c>
- DirectoryIndex /werc.rc
- </IfModule>
-
- RewriteRule ^/hg/(.*) /home/uriel/cat-v.org/bin/hgwebdir.cgi/$1 [L]
-
- RewriteRule /pub/style/style.css /home/uriel/cat-v.org/pub/style/style.css [L]
- RewriteRule /pub/ /home/uriel/cat-v.org/pub/ [L]
- RewriteRule /favicon.ico /home/uriel/cat-v.org/pub/default_favicon.ico [L]
-
-
- RewriteRule (.*) /home/uriel/cat-v.org/sites/%{HTTP_HOST}/$1
-
- RewriteCond %{REQUEST_FILENAME} !-f
- RewriteRule .* /home/uriel/cat-v.org/bin/werc.rc
-
- RewriteRule /werc.rc /home/uriel/cat-v.org/bin/werc.rc
- DocumentRoot /home/uriel/cat-v.org/bin/
- ErrorDocument 404 /werc.rc
-
- </VirtualHost>
-
--- a/sites/werc.cat-v.org/docs/web_server_setup/cherokee.md
+++ /dev/null
@@ -1,31 +1,0 @@
-Configuring werc with Cherokee
-==============================
-
-Contributed by sqweek, thanks!
-
-Cherokee Version 0.7.1
-----------------------
-
- vserver!default!rule!600!only_secure = 0
- vserver!default!rule!600!handler = cgi
- vserver!default!rule!600!handler!error_handler = 1
- vserver!default!rule!600!handler!check_file = 1
- vserver!default!rule!600!handler!script_alias =
- /usr/local/werc/bin/werc.rc
- vserver!default!rule!600!handler!pass_req_headers = 0
- vserver!default!rule!600!match = directory
- vserver!default!rule!600!match!directory = /code
- vserver!default!rule!600!match!final = 1
-
-
-Cherokee Version 0.5.3
-----------------------
-
- Directory /code {
- Handler cgi {
- Scriptalias /usr/local/werc/bin/werc.rc
- }
- }
-
-
-Isn't progress wonderful?
--- a/sites/werc.cat-v.org/docs/web_server_setup/hiawatha.md
+++ /dev/null
@@ -1,16 +1,0 @@
-Hiawatha Web Server Configuration
----------------------------------
-
-Contributed by sqweek, thanks!
-
-This are the relevant bits:
-
- CGIhandler = /usr/local/plan9/bin/rc:rc
- ExecuteCGI = yes
- RewriteURL = werc
- UrlRewrite {
- RewriteID = werc
- Match ^(/code|/index|/contact|/clique).* Rewrite /werc.rc
- Match ^/$ Rewrite /werc.rc
- }
-
--- a/sites/werc.cat-v.org/docs/web_server_setup/lighttpd.md
+++ /dev/null
@@ -1,44 +1,0 @@
-Setup werc with lighttpd
-========================
-
-You will need to enable to the following modules: `mod_cgi`, `mod_alias` and `mod_rewrite` (for non-minimal configurations).
-
-You can also find `mod_setenv` useful to change werc's environment ($PATH in perticular)
-
-Minimal setup
--------------
-This is the most minimal setup, for a single domain, and lets werc handle static files.
-
- $HTTP["host"] =~ "^test\.cat-v\.org$" {
- index-file.names = ( )
- server.error-handler-404 = "/werc.rc"
- alias.url += ( "/werc.rc" => "/var/www/cat-v.org/bin/werc.rc" ) # Here use the path to werc.rc in your system.
- cgi.assign += ( ".rc" => "")
- server.dir-listing = "disable"
- }
-
-Advanced setup
---------------
-
-A more ellaborate setup, using virtual hosts to handle multiple domains, and
-alias to let lighttpd handle static files. Also show how to add external cgi's
-to the setup, in this case Mercurial's web interface.
-
- $HTTP["host"] =~ "^((harmful|9p|gsoc|doc|uriel|src|repo|www|)(\.|)cat-v\.org|(www\.)?binarydream.org|)$" {
-
- index-file.names = ( )
- evhost.path-pattern = "/var/www/cat-v.org/sites/%3.%0/"
- server.error-handler-404 = "/werc.rc"
-
- alias.url += ( "/pub/" => "/var/www/cat-v.org/pub/" )
- alias.url += ( "/favicon.ico" => "/var/www/cat-v.org/pub/default_favicon.ico" )
- alias.url += ( "/doc/" => "/var/www/cat-v.org/sites/doc.cat-v.org/" )
- alias.url += ( "/werc.rc" => "/var/www/cat-v.org/bin/werc.rc" )
- alias.url += ( "/debug.rc" => "/var/www/cat-v.org/bin/debug.rc" )
- cgi.assign += ( ".rc" => "")
- server.dir-listing = "disable"
-
- cgi.assign += ( ".cgi" => "")
- url.rewrite-once = ( "/hg/(.*)" => "/hg/hgwebdir.cgi/$1" )
- alias.url += ( "/hg/" => "/var/www/cat-v.org/bin/" )
- }
--- a/sites/werc.cat-v.org/docs/web_server_setup/nginx.md
+++ /dev/null
@@ -1,96 +1,0 @@
-Setup werc with NGINX
-=====================
-
-You probably will want to to use fcgiwrap, called from spawn-fcgi or similar.
-
-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:
-
- worker_processes 1;
-
- #error_log logs/error.log;
- #error_log logs/error.log notice;
- error_log logs/error.log info;
-
- pid logs/nginx.pid;
-
- events {
- worker_connections 1024;
- }
-
-
- http {
- include mime.types;
- default_type application/octet-stream;
-
- #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
- # '$status $body_bytes_sent "$http_referer" '
- # '"$http_user_agent" "$http_x_forwarded_for"';
-
- #access_log logs/access.log main;
-
- sendfile on;
- #tcp_nopush on;
-
- #keepalive_timeout 0;
- keepalive_timeout 65;
-
- #gzip on;
-
- server {
- listen 80;
- server_name test.cat-v.org; # Replace with your domain name.
-
- #charset utf-8;
-
- #access_log logs/host.access.log main;
-
- location / {
-
- # FastCGI params, usually stored in fastcgi_params
- # and imported with a command like the following:
- #include fastcgi_params;
-
- # Typical contents of fastcgi_params (inlined here):
- fastcgi_pass localhost:9000;
-
- fastcgi_param QUERY_STRING $query_string;
- fastcgi_param REQUEST_METHOD $request_method;
- fastcgi_param CONTENT_TYPE $content_type;
- fastcgi_param CONTENT_LENGTH $content_length;
-
- #fastcgi_param SCRIPT_FILENAME /var/www/werc/bin/werc.rc;
- fastcgi_param SCRIPT_NAME /var/www/werc/bin/werc.rc;
- #fastcgi_param SCRIPT_NAME $fastcgi_script_name;
-
- fastcgi_param REQUEST_URI $request_uri;
- fastcgi_param DOCUMENT_URI $document_uri;
- fastcgi_param DOCUMENT_ROOT $document_root;
- fastcgi_param SERVER_PROTOCOL $server_protocol;
-
- fastcgi_param GATEWAY_INTERFACE CGI/1.1;
- fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
-
- fastcgi_param REMOTE_ADDR $remote_addr;
- fastcgi_param REMOTE_PORT $remote_port;
- fastcgi_param SERVER_ADDR $server_addr;
- fastcgi_param SERVER_PORT $server_port;
- fastcgi_param SERVER_NAME $server_name;
- fastcgi_param REMOTE_USER $remote_user;
-
- #root /var/www/werc/sites/$server_addr; # XXX This doesn't work, not sure why :(
- root /;
- #index index.html index.htm;
- }
- }
- }
-
-
-Then you can use spawn-fcgi or similar to get wrapcgi going:
-
- spawn-fcgi -a 127.0.0.1 -p 9000 -f /home/uriel/dvl/ext/fcgiwrap/fcgiwrap # Use the path to your fcgiwrap binary here
-
-
-Other Setups
-------------
-
-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.
--- a/sites/werc.cat-v.org/docs/web_server_setup/nhttpd.md
+++ /dev/null
@@ -1,60 +1,0 @@
-Nhttpd/Nostromo Web Server Configuration for Werc
-==================================================
-
-Contributed by nsz, thanks!
-
-The last two sections are relevant: aliases (to make non-content site material,
-like css, available) and virtual hosts (the document root is set to `werc.rc`
-so it will handle every request).
-
- # MAIN [MANDATORY]
-
- servername main.host.com
- serveradmin admin[at]mail.com
- serverroot /var/nostromo
- servermimes conf/mimes
- logpid logs/nhttpd.pid
- logaccess logs/access_log
- docroot /var/nostromo/htdocs
- docindex index.html
-
- # SETUID [RECOMMENDED]
-
- user nhttpd
-
- # BASIC AUTHENTICATION [OPTIONAL]
- #...
-
- # SSL [OPTIONAL]
- #...
-
- # CUSTOM RESPONSES [OPTIONAL]
- #...
-
- # HOMEDIRS [OPTIONAL]
- #...
-
- # ALIASES [OPTIONAL]
-
- /pub /path/to/werc/pub
- # The following line doesn't work because nhttpd doesn't support file aliases yet.
- #/favicon.ico /path/to/werc/pub/default_favicon.ico
-
- # VIRTUAL HOSTS [OPTIONAL]
-
- vhost1.com /path/to/werc/bin/werc.rc
- vhost2.com /path/to/werc/bin/werc.rc
- #...
-
-To use werc on `main.host.com` as well just set `docroot` to `/path/to/werc/bin/werc.rc`
-and set `docindex` to empty string.
-
-There was a bug in nhttpd <=1.9, it did not set `SERVER_NAME` properly (left it `main.host.com`).
-To solve this problem just add a
-
- SERVER_NAME=$HTTP_HOST
-
-line somewhere at the top of `werc.rc`.
-
-
-
--- a/sites/werc.cat-v.org/docs/web_server_setup/plan_9_httpd.md
+++ /dev/null
@@ -1,53 +1,0 @@
-Setup werc with Plan 9's httpd
-==============================
-
-
-There are two main options, you can use Russ Cox's magic to cgi translator
-(found in his contrib dir as cgi.c), or you can use the following script which
-while simpler, it also lacks some features at the moment.
-
-Thanks to soul9 for the original idea of wrapping werc in a shell script that
-would setup a cgi-like environment!
-
-
- #!/bin/rc
-
- SERVER_NAME=$2
- REQUEST_URI=`{echo $*(15)}
- REQUEST_URI=$REQUEST_URI(2)
- REQUEST_URI=/
- REQUEST_METHOD=$*(16)
- PLAN9=/
-
-
- echo 'HTTP/1.0 200 Ok
- Connection: close
- Server: werc/9.9.9' # This is whatever you like
-
-
- cd /usr/web/bin/
- rfork
- /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.
-
-Call this script werc-wrap, and put it in /rc/bin/ip/httpd/
-
-Then in your /sys/lib/httpd.rewrite add a line like:
-
- /w @/magic/werc-wrap
-
-And this will run werc for all stuff under /w. Note that apparently httpd is
-incapable of internally remapping the root directory, so until a solution is
-found for this, you will have to keep your site in a sub-directory of the web
-server root.
-
-In your /lib/namespace.httpd you probably will want to add something along the
-following lines to bind the werc directory into the httpd's namespace:
-
- bind -b /usr/glenda/src/werc/ /usr/web/
- bind /usr/glenda/src/werc/bin/ /usr/web/magic/
-
-
-**Notes**: This is experimental and work in progress, there are a couple of issues
-with the werc code itself that might need fixing, in particular you will need
-to replace the '%($"extraHeaders%)' in lib/headers.tpl with '% echo
-$"extraHeaders' no clue why.