Pmwiki /
Simpleurl
Httpd
OpenBSD http server. Initial setup
To setup let's encript ... Default setup
# $OpenBSD: httpd.conf,v 1.20 2018/06/13 15:08:24 reyk Exp $ types { include "/usr/share/misc/mime.types" } #ext_addr="egress" ext_addr="0.0.0.0" server "default" { listen on * port 80 location "/.well-known/acme-challenge/*" { root "/acme" request strip 2 } location * { block return 302 "https://$HTTP_HOST$REQUEST_URI" } }
Pmwiki
Reference for this solution is from ircnow, it was hard to get it working with requests containing query string and without. Solution was to comment a condition on pmwiki.php file in order to stop redirecting without disabling clean path config variable.
Httpd configuration;
server "wiki.leetio.dev" { listen on * tls port 443 tls { certificate "/etc/ssl/leetio.dev.fullchain.pem" key "/etc/ssl/private/leetio.dev.key" } root "/htdocs/wiki" directory index "/pmwiki.php" location "/" { root "/htdocs/wiki/pmwiki.php" fastcgi socket "/run/php-fpm.sock" } location match "/pub/(.*)" { request rewrite "/pub/%1" } location match "/cookbook/(.*)" { request rewrite "/cookbook/%1" } location match "/uploads/(.*)" { request rewrite "/uploads/%1" } location match "/(.+)/(.+)" { # check pmwiki.php ResolvePageName # loop redirects without query string # disable redirect condition solved # problem root "/htdocs/wiki" request rewrite "/pmwiki.php?n=%1.%2?$QUERY_STRING" fastcgi socket "/run/php-fpm.sock" } location match "/(.+)" { root "/htdocs/wiki" request rewrite "/pmwiki.php?n=%1?QUERY_STRING" fastcgi socket "/run/php-fpm.sock" } location "*.php*" { fastcgi socket "/run/php-fpm.sock" } }
File pmwiki.php change;
## ResolvePageName "normalizes" a pagename based on the current ## settings of $DefaultPage and $PagePathFmt. It's normally used ## during initialization to fix up any missing or partial pagenames. function ResolvePageName($pagename) { global $DefaultPage, $DefaultGroup, $DefaultName, $GroupPattern, $NamePattern, $EnableFixedUrlRedirect; SDV($DefaultPage, "$DefaultGroup.$DefaultName"); $pagename = preg_replace('!([./][^./]+)\\.html?$!', '$1', $pagename); if ($pagename == '') return $DefaultPage; $p = MakePageName($DefaultPage, $pagename); if (!preg_match("/^($GroupPattern)[.\\/]($NamePattern)$/i", $p)) { header('HTTP/1.1 404 Not Found'); Abort('$[?invalid page name]'); } if (preg_match("/^($GroupPattern)[.\\/]($NamePattern)$/i", $pagename)) return $p; //if (IsEnabled($EnableFixedUrlRedirect, 1) // && $p && (PageExists($p) || preg_match('/[\\/.]/', $pagename))) // { Redirect($p); exit(); } return MakePageName($DefaultPage, "$pagename.$pagename"); }
Cgit
server "git.leetio.dev" { listen on * tls port 443 tls { certificate "/etc/ssl/leetio.dev.fullchain.pem" key "/etc/ssl/private/leetio.dev.key" } root "/htdocs/wiki" # don't serve static files from cgit CGI: cgit.css and cgit.png location "/cgit.*" { root "/cgit" no fastcgi } root "/cgi-bin/cgit.cgi" fastcgi socket "/run/slowcgi.sock" }