From fc236567c25a40b6bddacaec4e545dc177fce728 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 24 Apr 2008 11:40:11 +0000 Subject: [PATCH] * Forgot to add (even though the twiki config is not general enough yet). svn path=/nixos/trunk/; revision=11700 --- upstart-jobs/apache-httpd/twiki.nix | 113 ++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 upstart-jobs/apache-httpd/twiki.nix diff --git a/upstart-jobs/apache-httpd/twiki.nix b/upstart-jobs/apache-httpd/twiki.nix new file mode 100644 index 000000000000..0a84f13ba7c7 --- /dev/null +++ b/upstart-jobs/apache-httpd/twiki.nix @@ -0,0 +1,113 @@ +{config, pkgs, serverInfo}: + +let + + inherit (pkgs.lib) mkOption; + inherit (config) urlPrefix distDir; + + dataDir = "/data/pt-wiki/data"; + pubDir = "/data/pt-wiki/pub"; + + scriptUrlPath = "/bin"; + pubUrlPath = "/pub"; + absHostPath = "/"; + + # Hacks for proxying and rewriting + dispPubUrlPath = "/pub"; + dispScriptUrlPath = ""; + dispViewPath = ""; + + twikiName = "Program Transformation Wiki"; + startWeb = config.startWeb; + registrationDomain = "ewi.tudelft.nl"; + defaultUrlHost = ""; + + # Build the TWiki CGI and configuration files. + twikiRoot = (import /etc/nixos/services/twiki/twiki-instance.nix).twiki { + name = "pt-wiki"; + pubdir = pubDir; + datadir = dataDir; + inherit twikiName scriptUrlPath pubUrlPath absHostPath + dispPubUrlPath dispScriptUrlPath dispViewPath + registrationDomain defaultUrlHost; + }; + + plugins = import /etc/nixos/services/twiki/server-pkgs/twiki-plugins.nix; + +in { + + extraConfig = '' + + ScriptAlias ${scriptUrlPath} "${twikiRoot}/bin" + Alias ${pubUrlPath} "${pubDir}" + + + Options +ExecCGI + SetHandler cgi-script + AllowOverride All + Allow from all + + + deny from all + + + deny from all + + + Options None + AllowOverride None + Allow from all + # Hardening suggested by http://twiki.org/cgi-bin/view/Codev/SecurityAlertSecureFileUploads. + php_admin_flag engine off + AddType text/plain .html .htm .shtml .php .php3 .phtml .phtm .pl .py .cgi + + + deny from all + + + Alias ${absHostPath} ${twikiRoot}/rewritestub/ + + + RewriteEngine On + RewriteBase ${absHostPath} + + # complete bin path + RewriteRule ^bin(.*) bin/$1 [L] + + #@customRewriteRules@ + + # Hack for restricted webs. + RewriteRule ^pt/(.*) $1 + + # action / web / whatever + RewriteRule ^([a-z]+)/([A-Z][^/]+)/(.*) bin/$1/$2/$3 [L] + + # web / topic + RewriteRule ^([A-Z][^/]+)/([^/]+) bin/view/$1/$2 [L] + + # web + RewriteRule ^([A-Z][^/]+) bin/view/$1/WebHome [L] + + # web/ + RewriteRule ^([A-Z][^/]+)/ bin/view/$1/WebHome [L] + + RewriteRule ^index.html$ bin/view/${startWeb} [L] + + RewriteRule ^$ bin/view/${startWeb} [L] + + + ''; + + # !!! should not be needed + extraModulesPre = []; + extraModules = []; + robotsEntries = ""; + globalEnvVars = []; + extraServerPath = []; + extraPath = []; + startupScript = null; + + options = { + }; + +} \ No newline at end of file