diff --git a/mdoc.su.nginx.conf b/mdoc.su.nginx.conf index 49852f0..61cf21e 100644 --- a/mdoc.su.nginx.conf +++ b/mdoc.su.nginx.conf @@ -42,14 +42,14 @@ server { 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
-Usage: mdoc.su/b/p @@ -57,14 +57,15 @@ server { mdoc.su/b/0/p where b is -, or - f|n|o|d, or - FreeBSD|NetBSD|OpenBSD|DragonFly, or + l|f|n|o|d, or + Linux|FreeBSD|NetBSD|OpenBSD|DragonFly, or same lower case , and p is the name of the manual page, and 0 is the section number. Now, what's mdoc? See: + http://mdoc.su/l/mdoc — according to Linux http://mdoc.su/f/mdoc — according to FreeBSD http://mdoc.su/n/mdoc — according to NetBSD http://mdoc.su/o/mdoc — according to OpenBSD @@ -92,6 +93,28 @@ Or, if you will, rewrite ^/(.*) $1; return 200 "google-site-verification: $uri"; } + location ^~ /Linux { + rewrite "^/Linux([ ,-/].*)?$" /linux$1 last; + return 404; + } + location ^~ /l { + set $lb "http://man7.org/linux/man-pages/man"; + set $ls1 "https://www.google.com/search?q="; + set $ls2 "&sitesearch=man7.org%2Flinux%2Fman-pages&sa=Search+online+pages"; + rewrite "^/Linux([ ,-/].*)?$" /linux$1; + rewrite ^/l([2-9])([0-9])([,/].*)?$ /linux-$1.$2$3; + rewrite ^/linux([,/].*)?$ /.$1; + rewrite ^/(?.)(?,)(.*)$ /$3 last; + if ($b) { + rewrite ^/(? .)(/.*)$ /-$2 last; + } + + rewrite ^/./([^/.]+)/([^/]+)$ $lb$1/$2.$1.html redirect; + rewrite ^/./([^/]+)\.([1-9])$ $lb$2/$1.$2.html redirect; + rewrite ^/./([^/]+)$ $ls1$1$ls2 redirect; + rewrite ^/./?$ / last; + return 410; + } location ^~ /FreeBSD { rewrite "^/FreeBSD([ ,-/].*)?$" /freebsd$1 last; return 404; @@ -99,6 +122,7 @@ Or, if you will, location ^~ /f { set $fb "http://www.freebsd.org/cgi/man.cgi?query="; set $fs "&sektion="; + rewrite "^/FreeBSD([ ,-/].*)?$" /freebsd$1; rewrite ^/f([4-9]|1[0-9])([0-9])([,/].*)?$ /freebsd-$1.$2$3; rewrite "^/freebsd[ -/](? [0-9]+(\.[0-9]+)+)([,/].*)?$" /.$3; rewrite ^/freebsd([,/].*)?$ /.$1; @@ -121,6 +145,7 @@ Or, if you will, } location ^~ /n { set $nb "http://netbsd.gw.com/cgi-bin/man-cgi?"; + rewrite "^/NetBSD([ ,-/].*)?$" /netbsd$1; rewrite ^/n([3-9])([0-9])([,/].*)?$ /netbsd-$1.$2$3; rewrite "^/netbsd[ -/](? [0-9]+(\.[0-9]+)+)([,/].*)?$" /.$3; rewrite ^/netbsd([,/].*)?$ /.$1; @@ -146,6 +171,7 @@ Or, if you will, location ^~ /o { set $ob "http://www.openbsd.org/cgi-bin/man.cgi?query="; set $os "&sektion="; + rewrite "^/OpenBSD([ ,-/].*)?$" /openbsd$1; rewrite ^/o([2-9])([0-9])([,/].*)?$ /openbsd-$1.$2$3; rewrite "^/openbsd[ -/](? [0-9]+(\.[0-9]+))([,/].*)?$" /.$3; rewrite ^/openbsd([,/].*)?$ /.$1; @@ -171,6 +197,7 @@ Or, if you will, location ^~ /d { set $db "http://leaf.dragonflybsd.org/cgi/web-man?command="; set $ds "§ion="; + rewrite ^/DragonFly(BSD)?([,/].*)?$ /d$2; rewrite ^/dragonfly(bsd)?([,/].*)?$ /d$2; rewrite ^/d(ragon)?fly([,/].*)?$ /d$2; rewrite ^/(? .)(?,)(.*)$ /$3 last; @@ -192,10 +219,11 @@ Or, if you will, location ~ "^/[a-z]{2,}\.?[1-9]?$" { rewrite ^ /-$uri; } - location ~ "^@/[fnod]{2,4}/" { + location ~ "^@/[lfnod]{2,4}/" { internal; rewrite ^@(.+) $1; set $b ,; + rewrite ^/([^/]*)(? l)(.*) /$1$3; rewrite ^/([^/]*)(? f)(.*) /$1$3; rewrite ^/([^/]*)(? n)(.*) /$1$3; rewrite ^/([^/]*)(? o)(.*) /$1$3; @@ -213,6 +241,7 @@ Or, if you will, rewrite ^/(.*) $1; default_type text/html; if ($b != ",") { + set $bl l; set $bf f; set $bn n; set $bo o; @@ -222,6 +251,10 @@ Or, if you will, if ($fr) { set $fr " $fr"; } if ($nr) { set $nr " $nr"; } if ($or) { set $or " $or"; } + if ($bl) { + set $ul +"$ul Linux \n"; + } if ($bf) { set $ul "$ulFreeBSD$fr \n";