forked from c3d2/nix-config
mediawiki: switch to nginx
This commit is contained in:
parent
ef20e18b86
commit
03e0cd2fbd
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, libC, pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.services.mediawiki;
|
cfg = config.services.mediawiki;
|
||||||
|
@ -67,37 +67,27 @@ in
|
||||||
sha256 = "sha256-N1+OV1UdzvU4iXhaS/+fuEoAXqrkVyyEPDirk0vrT8A=";
|
sha256 = "sha256-N1+OV1UdzvU4iXhaS/+fuEoAXqrkVyyEPDirk0vrT8A=";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
httpd.virtualHost = {
|
|
||||||
adminAddr = "no-reply@c3d2.de";
|
name = "C3D2";
|
||||||
enableACME = true;
|
nginx.hostName = "wiki.c3d2.de";
|
||||||
forceSSL = true;
|
|
||||||
hostName = "wiki.c3d2.de";
|
|
||||||
extraConfig = ''
|
|
||||||
RewriteEngine On
|
|
||||||
RewriteRule ^/w/(.*).php /$1.php [L,QSA]
|
|
||||||
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
|
|
||||||
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
|
|
||||||
RewriteCond %{REQUEST_URI} !^/images
|
|
||||||
RewriteRule ^(.*) /index.php/$1 [L,QSA]
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
#skins = {
|
#skins = {
|
||||||
# Vector = "${config.services.mediawiki.package}/share/mediawiki/skins/Vector";
|
# Vector = "${config.services.mediawiki.package}/share/mediawiki/skins/Vector";
|
||||||
# Hector = "${config.services.mediawiki.package}/share/mediawiki/skins/Hector";
|
# Hector = "${config.services.mediawiki.package}/share/mediawiki/skins/Hector";
|
||||||
#};
|
#};
|
||||||
|
|
||||||
name = "C3D2";
|
|
||||||
# initial admin user password
|
# initial admin user password
|
||||||
passwordFile = config.sops.secrets."mediawiki/adminPassword".path;
|
passwordFile = config.sops.secrets."mediawiki/adminPassword".path;
|
||||||
uploadsDir = "/var/lib/mediawiki/uploads";
|
uploadsDir = "/var/lib/mediawiki/uploads";
|
||||||
|
webserver = "nginx";
|
||||||
|
|
||||||
extraConfig = /* php */ ''
|
extraConfig = /* php */ ''
|
||||||
$wgArticlePath = '/$1';
|
$wgAllowUserCss = true;
|
||||||
|
|
||||||
$wgShowExceptionDetails = true;
|
|
||||||
$wgDBserver = "${config.services.mediawiki.database.socket}";
|
|
||||||
$wgDBmwschema = "mediawiki";
|
$wgDBmwschema = "mediawiki";
|
||||||
|
$wgEnableAPI = true;
|
||||||
|
$wgEnableMWSuggest = true;
|
||||||
|
$wgShowExceptionDetails = true;
|
||||||
|
$wgUseAjax = true;
|
||||||
|
|
||||||
$wgLogo = "https://www.c3d2.de/images/ck.png";
|
$wgLogo = "https://www.c3d2.de/images/ck.png";
|
||||||
$wgEmergencyContact = "wiki@c3d2.de";
|
$wgEmergencyContact = "wiki@c3d2.de";
|
||||||
|
@ -160,18 +150,9 @@ in
|
||||||
$wgCaptchaClass = 'QuestyCaptcha';
|
$wgCaptchaClass = 'QuestyCaptcha';
|
||||||
$wgCaptchaQuestions[] = array( 'question' => 'How is C3D2 logo in ascii?', 'answer' => '<<</>>' );
|
$wgCaptchaQuestions[] = array( 'question' => 'How is C3D2 logo in ascii?', 'answer' => '<<</>>' );
|
||||||
|
|
||||||
# we are using the feature of the default extension interwiki for linking to other articles of the same domain
|
|
||||||
# https://www.mediawiki.org/wiki/Extension:Interwiki
|
|
||||||
# without loading this extension there is no page Spezial:Interwikitablle (aka Special:Interwiki) to manage the table of entries for interwiki links
|
|
||||||
wfLoadExtension( 'Interwiki' );
|
wfLoadExtension( 'Interwiki' );
|
||||||
# all members of the sysop group should be able to manage entries for interwiki links
|
|
||||||
$wgGroupPermissions['sysop']['interwiki'] = true;
|
$wgGroupPermissions['sysop']['interwiki'] = true;
|
||||||
|
|
||||||
$wgEnableAPI = true;
|
|
||||||
$wgAllowUserCss = true;
|
|
||||||
$wgUseAjax = true;
|
|
||||||
$wgEnableMWSuggest = true;
|
|
||||||
|
|
||||||
wfLoadExtension('Cite');
|
wfLoadExtension('Cite');
|
||||||
wfLoadExtension('CiteThisPage');
|
wfLoadExtension('CiteThisPage');
|
||||||
wfLoadExtension('ConfirmEdit');
|
wfLoadExtension('ConfirmEdit');
|
||||||
|
@ -191,6 +172,19 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nginx = {
|
||||||
|
enable = true;
|
||||||
|
commonHttpConfig = ''
|
||||||
|
# for some reason nginx adds a port for the 301 redirect from / to /wiki/
|
||||||
|
port_in_redirect off;
|
||||||
|
'';
|
||||||
|
virtualHosts."wiki.c3d2.de" = {
|
||||||
|
enableACME = true;
|
||||||
|
forceSSL = true;
|
||||||
|
listen = libC.defaultListen;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
phpfpm.phpPackage = pkgs.php.buildEnv {
|
phpfpm.phpPackage = pkgs.php.buildEnv {
|
||||||
extensions = { all, enabled }: enabled ++ (with all; [ apcu ]);
|
extensions = { all, enabled }: enabled ++ (with all; [ apcu ]);
|
||||||
};
|
};
|
||||||
|
@ -203,7 +197,7 @@ in
|
||||||
ensurePermissions = { "DATABASE ${cfg.database.name}" = "ALL PRIVILEGES"; };
|
ensurePermissions = { "DATABASE ${cfg.database.name}" = "ALL PRIVILEGES"; };
|
||||||
}];
|
}];
|
||||||
package = pkgs.postgresql_16;
|
package = pkgs.postgresql_16;
|
||||||
upgrade.stopServices = [ "httpd" "phpfpm-mediawiki" ];
|
upgrade.stopServices = [ "phpfpm-mediawiki" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user