swerc

anselm's simpler werc fork
git clone git://git.suckless.org/swerc
Log | Files | Refs | README

commit 75a6f74888269a2c4e3baa9a79fe71bd1e32ffe6
parent c70d9b267f0e12f547bee871e7c37367457888eb
Author: uriel@engel.se.cat-v.org <unknown>
Date:   Tue, 20 Jan 2009 03:52:21 +0100

Add werc.cat-v.org/ site, it serves as sample site.
Diffstat:
Asites/werc.cat-v.org/_werc/config | 3+++
Asites/werc.cat-v.org/docs/config_options.md | 0
Asites/werc.cat-v.org/docs/rc_template_lang.md | 0
Asites/werc.cat-v.org/docs/web_server_setup/apache.md | 92+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asites/werc.cat-v.org/docs/web_server_setup/cherokee.md | 31+++++++++++++++++++++++++++++++
Asites/werc.cat-v.org/docs/web_server_setup/lighttpd.md | 40++++++++++++++++++++++++++++++++++++++++
Asites/werc.cat-v.org/docs/web_server_setup/nginx.md | 4++++
Asites/werc.cat-v.org/docs/web_server_setup/nhttpd.md | 56++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asites/werc.cat-v.org/docs/web_server_setup/plan_9_httpd.md | 4++++
Asites/werc.cat-v.org/index.md | 8++++++++
Asites/werc.cat-v.org/wiki/_werc/config | 2++
11 files changed, 240 insertions(+), 0 deletions(-)

diff --git a/sites/werc.cat-v.org/_werc/config b/sites/werc.cat-v.org/_werc/config @@ -0,0 +1,3 @@ +siteTitle='werc' +siteSubTitle='Bringing minimalism and sanity to the web' + diff --git a/sites/werc.cat-v.org/docs/config_options.md b/sites/werc.cat-v.org/docs/config_options.md diff --git a/sites/werc.cat-v.org/docs/rc_template_lang.md b/sites/werc.cat-v.org/docs/rc_template_lang.md diff --git a/sites/werc.cat-v.org/docs/web_server_setup/apache.md b/sites/werc.cat-v.org/docs/web_server_setup/apache.md @@ -0,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> + diff --git a/sites/werc.cat-v.org/docs/web_server_setup/cherokee.md b/sites/werc.cat-v.org/docs/web_server_setup/cherokee.md @@ -0,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? diff --git a/sites/werc.cat-v.org/docs/web_server_setup/lighttpd.md b/sites/werc.cat-v.org/docs/web_server_setup/lighttpd.md @@ -0,0 +1,40 @@ +Setup werc with lighttpd +======================== + +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/" ) + } diff --git a/sites/werc.cat-v.org/docs/web_server_setup/nginx.md b/sites/werc.cat-v.org/docs/web_server_setup/nginx.md @@ -0,0 +1,4 @@ +Setup werc with NGINX +===================== + +No sample conf at the moment (please send me one if you have a setup using NGINX). You probably will want to to use [fcgiwrap](http://nginx.localdomain.pl/wiki/FcgiWrap) diff --git a/sites/werc.cat-v.org/docs/web_server_setup/nhttpd.md b/sites/werc.cat-v.org/docs/web_server_setup/nhttpd.md @@ -0,0 +1,56 @@ +Nhttpd config 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 + /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 (leaft it `main.host.com`). +To solve this problem just add a + + SERVER_NAME=$HTTP_HOST + +line somewhere at the top of `werc.rc`. diff --git a/sites/werc.cat-v.org/docs/web_server_setup/plan_9_httpd.md b/sites/werc.cat-v.org/docs/web_server_setup/plan_9_httpd.md @@ -0,0 +1,4 @@ +Setup werc with Plan 9's httpd +============================== + +Coming soon, thanks to soul9! diff --git a/sites/werc.cat-v.org/index.md b/sites/werc.cat-v.org/index.md @@ -0,0 +1,8 @@ +Werc is a minimalist web framework built on the Unix and Plan 9 *tool philosophy* of software design. + +* Database free, uses files and directories instead. +* Written using the rc shell, leveraging the standard unix/plan9 command toolkit. +* Minimize tedious work: avoid having to write HTML, can use markdown instead. +* Very minimalist yet extensible codebase: 150 lines of code highly functional core, with extra functionality in modular apps. + + diff --git a/sites/werc.cat-v.org/wiki/_werc/config b/sites/werc.cat-v.org/wiki/_werc/config @@ -0,0 +1,2 @@ +enable_wiki=yes +enabled_apps=($enabled_apps bridge dirdir)