MediaWiki: Difference between revisions
Appearance
imported>Redvers Initial mediawiki guide. |
Phanirithvij (talk | contribs) m fix mediawiki extension url |
||
| (22 intermediate revisions by 13 users not shown) | |||
| Line 1: | Line 1: | ||
[https:// | [https://mediawiki.org/ {{PAGENAME}}] ([[wikipedia:en:{{PAGENAME}}]]) is available as a [[module]]. | ||
== | == Configuration Examples == | ||
=== Small Configuration === | |||
<syntaxhighlight lang="nix"> | |||
services.mediawiki = { | |||
enable = true; | |||
name = "Sample MediaWiki"; | |||
httpd.virtualHost = { | |||
hostName = "example.com"; | |||
adminAddr = "admin@example.com"; | |||
}; | |||
# Administrator account username is admin. | |||
# Set initial password to "cardbotnine" for the account admin. | |||
passwordFile = pkgs.writeText "password" "cardbotnine"; | |||
extraConfig = '' | |||
# Disable anonymous editing | |||
$wgGroupPermissions['*']['edit'] = false; | |||
''; | |||
== | extensions = { | ||
# some extensions are included and can enabled by passing null | |||
VisualEditor = null; | |||
# https://www.mediawiki.org/wiki/Extension:TemplateStyles | |||
TemplateStyles = pkgs.fetchzip { | |||
url = "https://extdist.wmflabs.org/dist/extensions/TemplateStyles-REL1_40-5c3234a.tar.gz"; | |||
hash = "sha256-IygCDgwJ+hZ1d39OXuJMrkaxPhVuxSkHy9bWU5NeM/E="; | |||
}; | |||
}; | |||
}; | |||
</syntaxhighlight> | |||
== Web Server == | |||
By default, the <code>services.mediawiki</code> module creates a <code>services.httpd.virtualHost</code> which can be configured via the <code>services.mediawiki.httpd.virtualHost</code> submodule. | |||
If you are using another web server (like [[Nginx]]), you can configure MediaWiki for a reverse proxy with the <code>services.mediawiki.virtualHost.listen</code> option: | |||
<syntaxhighlight lang="nix"> | |||
services.mediawiki.httpd.virtualHost.listen = [ | |||
{ | |||
ip = "127.0.0.1"; | |||
port = 8080; | |||
ssl = false; | |||
} | |||
]; | |||
</syntaxhighlight> | |||
Alternatively, <code>services.mediawiki.webserver</code> can be set to <code>"nginx"</code> to use nginx instead of [[Apache HTTP Server|apache]]. | |||
=== | == Troubleshooting == | ||
=== Edit php.ini === | |||
A [[Phpfpm|php-fpm]] pool is automatically created when Mediawiki is enabled. The <code>php.ini</code> file can be modified by using <code>phpOptions</code>. The following example shows how to increase the allowed file upload size. | |||
<syntaxhighlight lang="nix"> | |||
services.phpfpm.pools.mediawiki.phpOptions = '' | |||
upload_max_filesize = 10M | |||
post_max_size = 15M | |||
''; | |||
</syntaxhighlight> | |||
== See Also == | |||
* [https://github.com/NixOS/nixos-wiki-infra Configuration of the NixOS wiki] | |||
* [https://github.com/NixOS/nixpkgs/blob/master/nixos/tests/mediawiki.nix nixos/tests/mediawiki.nix] | |||
* [[Dokuwiki]], simple PHP- and web-based wiki software which uses file based storage for its content. | |||
* [[Outline]], a modern web based wiki and knowledge base for teams. | |||
[[Category:Guide]] | [[Category:Guide]] | ||
[[Category:Server]] | |||
[[Category:Web Applications]] | |||
Latest revision as of 05:22, 18 September 2024
MediaWiki (wikipedia:en:MediaWiki) is available as a module.
Configuration Examples
Small Configuration
services.mediawiki = {
enable = true;
name = "Sample MediaWiki";
httpd.virtualHost = {
hostName = "example.com";
adminAddr = "admin@example.com";
};
# Administrator account username is admin.
# Set initial password to "cardbotnine" for the account admin.
passwordFile = pkgs.writeText "password" "cardbotnine";
extraConfig = ''
# Disable anonymous editing
$wgGroupPermissions['*']['edit'] = false;
'';
extensions = {
# some extensions are included and can enabled by passing null
VisualEditor = null;
# https://www.mediawiki.org/wiki/Extension:TemplateStyles
TemplateStyles = pkgs.fetchzip {
url = "https://extdist.wmflabs.org/dist/extensions/TemplateStyles-REL1_40-5c3234a.tar.gz";
hash = "sha256-IygCDgwJ+hZ1d39OXuJMrkaxPhVuxSkHy9bWU5NeM/E=";
};
};
};
Web Server
By default, the services.mediawiki module creates a services.httpd.virtualHost which can be configured via the services.mediawiki.httpd.virtualHost submodule.
If you are using another web server (like Nginx), you can configure MediaWiki for a reverse proxy with the services.mediawiki.virtualHost.listen option:
services.mediawiki.httpd.virtualHost.listen = [
{
ip = "127.0.0.1";
port = 8080;
ssl = false;
}
];
Alternatively, services.mediawiki.webserver can be set to "nginx" to use nginx instead of apache.
Troubleshooting
Edit php.ini
A php-fpm pool is automatically created when Mediawiki is enabled. The php.ini file can be modified by using phpOptions. The following example shows how to increase the allowed file upload size.
services.phpfpm.pools.mediawiki.phpOptions = ''
upload_max_filesize = 10M
post_max_size = 15M
'';
See Also
- Configuration of the NixOS wiki
- nixos/tests/mediawiki.nix
- Dokuwiki, simple PHP- and web-based wiki software which uses file based storage for its content.
- Outline, a modern web based wiki and knowledge base for teams.