announcing mdoc.su, short manual page URLs

2013-02-20 Thread Constantine A. Murenin

Dear misc, www,

I would like to announce and introduce URL:http://mdoc.su/, 
a deterministic URL shortener for BSD manual pages, 
written entirely in nginx.conf.


It supports several addressing schemes, for example:

 http://mdoc.su/o/pf
 http://mdoc.su/o/pf.4
 http://mdoc.su/o/4/pf
 http://mdoc.su/openbsd/pf
 http://mdoc.su/OpenBSD/pf

 http://mdoc.su/f/pf
 http://mdoc.su/n/pf
 http://mdoc.su/d/pf

 http://mdoc.su/o/sort.3p

 http://mdoc.su/o/intro.4.macppc
 http://mdoc.su/openbsd/macppc/4/intro

Source code for the whole mdoc.su.nginx.conf is available at:

 https://github.com/cnst/mdoc.su
 https://bitbucket.org/cnst/mdoc.su

Specifically, the following currently controls OpenBSD rewriting:

location /OpenBSD { rewrite ^/OpenBSD(/.*)?$/o$1;   }
location /o {
set $ob http://www.openbsd.org/cgi-bin/man.cgi?query=;;
set $os sektion=;
rewrite ^/openbsd(/.*)?$/.$1;
rewrite ^/./([a-z]+[0-9]*[k]?)/([1-9]|3p)/([^/]+)$  
$ob$3$os$2arch=$1  redirect;
rewrite ^/./([^/.]+)/([^/]+)$   $ob$2$os$1  
redirect;
rewrite ^/./([^/]+)\.([1-9]|3p)\.([a-z]+[0-9]*[k]?)$
$ob$1$os$2arch=$3  redirect;
rewrite ^/./([^/]+)\.([1-9]|3p)$$ob$1$os$2  
redirect;
rewrite ^/./([^/]+)$$ob$1$os
redirect;
rewrite ^/./?$  /   last;
return  404;
}

Translation: /OpenBSD and /openbsd get rewritten to /o internally, 
without any extra replies to the user, and then the rest of the URI is 
analysed, and a 302 Found redirect is finally issued to the user.  
(If you haven't yet noticed nginx in the base tree, here's your chance!)


Pages like http://mdoc.su/o/ redirect to the main / page internally, 
without affecting the URL that's visible to the user, making it easier 
to keep a starting page specifically for one BSD.


Questions, comments and suggestions are welcome.  
Available through IPv4 and IPv6.  
Enjoy!


Cheers,
Constantine.



Re: announcing mdoc.su, short manual page URLs

2013-02-20 Thread Maximo Pech
Just used it, works fine and is easy to remember.

El miércoles, 20 de febrero de 2013, Constantine A. Murenin escribió:

 Dear misc, www,

 I would like to announce and introduce URL:http://mdoc.su/, a
 deterministic URL shortener for BSD manual pages, written entirely in
 nginx.conf.

 It supports several addressing schemes, for example:

  http://mdoc.su/o/pf
  http://mdoc.su/o/pf.4
  http://mdoc.su/o/4/pf
  http://mdoc.su/openbsd/pf
  http://mdoc.su/OpenBSD/pf

  http://mdoc.su/f/pf
  http://mdoc.su/n/pf
  http://mdoc.su/d/pf

  http://mdoc.su/o/sort.3p

  http://mdoc.su/o/intro.4.**macppc http://mdoc.su/o/intro.4.macppc

http://mdoc.su/openbsd/macppc/**4/introhttp://mdoc.su/openbsd/macppc/4/intro


 Source code for the whole mdoc.su.nginx.conf is available at:

  https://github.com/cnst/mdoc.**su https://github.com/cnst/mdoc.su
  https://bitbucket.org/cnst/**mdoc.su https://bitbucket.org/cnst/mdoc.su

 Specifically, the following currently controls OpenBSD rewriting:

 location /OpenBSD { rewrite ^/OpenBSD(/.*)?$/o$1;   }
 location /o {
 set $ob http://www.openbsd.org/cgi-**
 bin/man.cgi?query= http://www.openbsd.org/cgi-bin/man.cgi?query=;
 set $os sektion=;
 rewrite ^/openbsd(/.*)?$/.$1;
 rewrite ^/./([a-z]+[0-9]*[k]?)/([1-9]|**3p)/([^/]+)$
  $ob$3$os$2arch=$1  redirect;
 rewrite ^/./([^/.]+)/([^/]+)$   $ob$2$os$1
  redirect;
 rewrite ^/./([^/]+)\.([1-9]|3p)\.([a-**z]+[0-9]*[k]?)$
  $ob$1$os$2arch=$3  redirect;
 rewrite ^/./([^/]+)\.([1-9]|3p)$$ob$1$os$2
  redirect;
 rewrite ^/./([^/]+)$$ob$1$os
  redirect;
 rewrite ^/./?$  /   last;
 return  404;
 }

 Translation: /OpenBSD and /openbsd get rewritten to /o internally,
 without any extra replies to the user, and then the rest of the URI is
 analysed, and a 302 Found redirect is finally issued to the user.  (If
 you haven't yet noticed nginx in the base tree, here's your chance!)

 Pages like http://mdoc.su/o/ redirect to the main / page internally,
 without affecting the URL that's visible to the user, making it easier to
 keep a starting page specifically for one BSD.

 Questions, comments and suggestions are welcome.  Available through IPv4
 and IPv6.  Enjoy!

 Cheers,
 Constantine.