Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add linux man pages and fix case insensitive installs #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 38 additions & 5 deletions mdoc.su.nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -42,29 +42,30 @@ server {
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-CA' lang='en-CA'>
<head>
<title>mdoc.su &mdash; Manual Pages for FreeBSD, OpenBSD, NetBSD and DragonFly BSD!</title>
<title>mdoc.su &mdash; Manual Pages for Linux, FreeBSD, OpenBSD, NetBSD and DragonFly BSD!</title>
<meta name='description' content='Deterministic URL shortener for BSD manual pages, written in nginx.conf'/>
<meta name='keywords' content='short manual page URLs, man, URL, BSD UNIX'/>
</head>
<body>
<div style='text-align: center;'>
<h1 style='margin: 4pt auto; color: navy;'>mdoc.su</h1>
<h2 style='margin: 4pt auto;'>man pages for FreeBSD, NetBSD, OpenBSD and DragonFly</h2>
<h2 style='margin: 4pt auto;'>man pages for Linux, FreeBSD, NetBSD, OpenBSD and DragonFly</h2>
<hr style='width: 48em; font-family: monospace; border: none; border-top: 1px solid navy;'/>
<pre style='margin: 0 auto; width: 48em; font-family: monospace; text-align: left;'>Usage:
<strong>mdoc.su/b/p</strong>
<strong>mdoc.su/b/p.0</strong>
<strong>mdoc.su/b/0/p</strong>
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:
<a href='http://mdoc.su/l/mdoc'>http://mdoc.su/l/mdoc</a> &mdash; according to Linux
<a href='http://mdoc.su/f/mdoc'>http://mdoc.su/f/mdoc</a> &mdash; according to FreeBSD
<a href='http://mdoc.su/n/mdoc'>http://mdoc.su/n/mdoc</a> &mdash; according to NetBSD
<a href='http://mdoc.su/o/mdoc'>http://mdoc.su/o/mdoc</a> &mdash; according to OpenBSD
Expand Down Expand Up @@ -92,13 +93,36 @@ 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 ^/(?<bl>.)(?<b>,)(.*)$ /$3 last;
if ($b) {
rewrite ^/(?<bl>.)(/.*)$ /-$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;
}
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[ -/](?<fr>[0-9]+(\.[0-9]+)+)([,/].*)?$" /.$3;
rewrite ^/freebsd([,/].*)?$ /.$1;
Expand All @@ -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[ -/](?<nr>[0-9]+(\.[0-9]+)+)([,/].*)?$" /.$3;
rewrite ^/netbsd([,/].*)?$ /.$1;
Expand All @@ -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[ -/](?<or>[0-9]+(\.[0-9]+))([,/].*)?$" /.$3;
rewrite ^/openbsd([,/].*)?$ /.$1;
Expand All @@ -171,6 +197,7 @@ Or, if you will,
location ^~ /d {
set $db "http://leaf.dragonflybsd.org/cgi/web-man?command=";
set $ds "&section=";
rewrite ^/DragonFly(BSD)?([,/].*)?$ /d$2;
rewrite ^/dragonfly(bsd)?([,/].*)?$ /d$2;
rewrite ^/d(ragon)?fly([,/].*)?$ /d$2;
rewrite ^/(?<bd>.)(?<b>,)(.*)$ /$3 last;
Expand All @@ -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 ^/([^/]*)(?<bl>l)(.*) /$1$3;
rewrite ^/([^/]*)(?<bf>f)(.*) /$1$3;
rewrite ^/([^/]*)(?<bn>n)(.*) /$1$3;
rewrite ^/([^/]*)(?<bo>o)(.*) /$1$3;
Expand All @@ -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;
Expand All @@ -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<li style='margin: 8pt;'><a href='/Linux/$uri'>Linux</a></li>\n";
}
if ($bf) {
set $ul
"$ul<li style='margin: 8pt;'><a href='/FreeBSD$fr/$uri'>FreeBSD$fr</a></li>\n";
Expand Down