帮助:MediaWiki 安装:修订间差异
来自陋室
更多操作
删除的内容 添加的内容
小 添加模板 |
修改内容 |
||
| 第1行: | 第1行: | ||
这个页面介绍了本站的 MediaWiki 的安装笔记. |
这个页面介绍了本站的 [[mw:Download|MediaWiki]] 的安装笔记. |
||
== 服务器配置 == |
== 服务器配置 == |
||
'''服务器提供商''': 腾讯云-轻量云(轻量应用服务器) |
|||
'''服务器提供商''': [https://cloud.tencent.com/ 腾讯云]-轻量云(轻量应用服务器) |
|||
'''地域和可用区''': 新加坡 | 新加坡一区 |
'''地域和可用区''': 新加坡 | 新加坡一区 |
||
'''实例规格''': |
'''实例规格''': |
||
* '''CPU''': 2核 |
|||
* '''CPU''': 2 核 |
|||
* '''内存''': 2GB |
* '''内存''': 2GB |
||
* '''系统盘''': SSD云硬盘 50GB |
* '''系统盘''': SSD 云硬盘 50GB |
||
* '''流量包''': 1024GB/月(峰值带宽 30Mbps) |
* '''流量包''': 1024GB/月(峰值带宽 30Mbps) |
||
== 服务器环境 == |
== 服务器环境 == |
||
=== 操作系统 === |
=== 操作系统 === |
||
'''镜像名称''': Debian |
|||
'''镜像名称''': [https://www.debian.org/distrib/ Debian] |
|||
'''操作系统''': Debian 12.0 64bit |
'''操作系统''': Debian 12.0 64bit |
||
| 第23行: | 第28行: | ||
=== 服务器软件 === |
=== 服务器软件 === |
||
* '''宝塔Linux面板''': 正式版9.4.0 |
|||
* '''[https://www.bt.cn/new/download.html 宝塔Linux面板]''' : 正式版 9.4.0 |
|||
<syntaxhighlight lang="bash"> |
<syntaxhighlight lang="bash"> |
||
wget -O install_panel.sh https://download.bt.cn/install/install_panel.sh && bash install_panel.sh ed8484bec |
wget -O install_panel.sh https://download.bt.cn/install/install_panel.sh && bash install_panel.sh ed8484bec |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
* '''Apache 2.4.62 (PHP+fpm)''' |
|||
* '''Apache [https://httpd.apache.org/download.cgi httpd] 2.4.62 (PHP+fpm)''' |
|||
<syntaxhighlight lang="bash"> |
<syntaxhighlight lang="bash"> |
||
which apache2 |
which apache2 |
||
apache2 -v |
apache2 -v |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
* '''MySQL 5.7.44'''(MediaWiki最低要求5.7,官方推荐MongoDB) |
|||
* '''[https://dev.mysql.com/downloads/windows/installer/ MySQL 5.7.44]'''(MediaWiki 最低要求 5.7,大内存机器首选 8.0+,官方推荐 MongoDB) |
|||
<syntaxhighlight lang="bash"> |
<syntaxhighlight lang="bash"> |
||
which mysql |
which mysql |
||
systemctl status mysql |
systemctl status mysql |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
* '''PHP 8.2.27'''(MediaWiki最低要求8.1) |
|||
* '''[https://www.php.net/downloads.php PHP] 8.2.27'''(MediaWiki 最低要求 8.1) |
|||
<syntaxhighlight lang="bash"> |
<syntaxhighlight lang="bash"> |
||
which php |
which php |
||
php -v |
php -v |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
* '''phpMyAdmin 5.2'''(可通过宝塔安装) |
|||
* '''ffmpeg 6.1'''(可通过宝塔安装) |
|||
<syntaxhighlight lang="bash"> |
|||
which ffmpeg |
|||
ffmpeg -version |
|||
</syntaxhighlight> |
|||
* '''[https://www.phpmyadmin.net/downloads/ phpMyAdmin] 5.2'''(可通过宝塔安装) |
|||
=== 依赖软件安装 === |
|||
==== php-wikidiff2 ==== |
|||
== 服务器依赖 == |
|||
=== php-[[mw:Wikidiff2|wikidiff2]] === |
|||
<syntaxhighlight lang="bash"> |
<syntaxhighlight lang="bash"> |
||
apt-get install php-wikidiff2 |
apt-get install php-wikidiff2 |
||
| 第58行: | 第65行: | ||
php -m | grep wikidiff2 |
php -m | grep wikidiff2 |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
<syntaxhighlight lang="php"> |
<syntaxhighlight lang="php"> |
||
$wgDiffEngine = "wikidiff2"; |
$wgDiffEngine = "wikidiff2"; |
||
| 第63行: | 第71行: | ||
</syntaxhighlight> |
</syntaxhighlight> |
||
=== php-[https://www.mediawiki.org/wiki/LuaSandbox luasandbox] === |
|||
==== LilyPond ==== |
|||
<syntaxhighlight lang="bash"> |
<syntaxhighlight lang="bash"> |
||
sudo apt update |
sudo apt update |
||
sudo apt install |
sudo apt install php-luasandbox -y |
||
find /usr/lib/php/ -name "luasandbox.so" |
|||
lilypond --version |
|||
nano /www/server/php/82/etc/php.ini |
|||
extension=/usr/lib/php/20220829/luasandbox.so |
|||
php -m | grep luasandbox |
|||
</syntaxhighlight> |
</syntaxhighlight> |
||
<syntaxhighlight lang="php"> |
<syntaxhighlight lang="php"> |
||
wfLoadExtension( ' |
wfLoadExtension( 'Scribunto' ); |
||
$wgScribuntoEngineConf['luasandbox']['memoryLimit'] = 50 * 1024 * 1024; |
|||
$wgScoreTrim = true; |
|||
$wgImageMagickConvertCommand = '/usr/bin/convert'; |
|||
$wgScoreSafeMode = false; |
|||
</syntaxhighlight> |
</syntaxhighlight> |
||
=== [https://ffmpeg.org/download.html ffmpeg] 6.1(可通过宝塔安装) === |
|||
==== Ghostscript ==== |
|||
<syntaxhighlight lang="bash"> |
<syntaxhighlight lang="bash"> |
||
which ffmpeg |
|||
sudo apt update |
|||
ffmpeg -version |
|||
sudo apt install ghostscript |
|||
gs --version |
|||
</syntaxhighlight> |
</syntaxhighlight> |
||
=== [https://getcomposer.org/download/ Composer] === |
|||
==== FluidSynth ==== |
|||
<syntaxhighlight lang="bash"> |
|||
composer update --no-dev |
|||
</syntaxhighlight> |
|||
== MediaWiki 插件依赖 == |
|||
=== [[mw:Extension:EasyTimeline|EasyTimeline]] === |
|||
==== [https://ploticus.sourceforge.net/doc/download.html Ploticus] ==== |
|||
<syntaxhighlight lang="bash"> |
<syntaxhighlight lang="bash"> |
||
sudo apt update |
sudo apt update |
||
sudo apt install |
sudo apt install ploticus |
||
ploticus -version |
|||
</syntaxhighlight> |
</syntaxhighlight> |
||
==== |
==== [https://www.perl.org/get.html perl] ==== |
||
<syntaxhighlight lang="bash"> |
<syntaxhighlight lang="bash"> |
||
sudo apt update |
sudo apt update |
||
sudo apt install |
sudo apt install perl |
||
perl -v |
|||
lame --version |
|||
</syntaxhighlight> |
</syntaxhighlight> |
||
<syntaxhighlight lang="php"> |
<syntaxhighlight lang="php"> |
||
$ |
$wgTimelinePloticusCommand = '/usr/bin/ploticus'; |
||
$wgTimelinePerlCommand = "/usr/bin/perl"; |
|||
$wgTimelineFontDirectory = "/usr/share/fonts/truetype/freefont"; |
|||
$wgTimelineFontFile = 'ascii'; |
|||
</syntaxhighlight> |
</syntaxhighlight> |
||
=== [[mw:Extension:Score|Score]] === |
|||
==== [https://lilypond.org/ LilyPond] ==== |
|||
<syntaxhighlight lang="bash"> |
<syntaxhighlight lang="bash"> |
||
sudo apt update |
sudo apt update |
||
sudo apt install |
sudo apt install lilypond |
||
lilypond --version |
|||
find /usr/lib/php/ -name "luasandbox.so" |
|||
nano /www/server/php/82/etc/php.ini |
|||
extension=/usr/lib/php/20220829/luasandbox.so |
|||
php -m | grep luasandbox |
|||
</syntaxhighlight> |
</syntaxhighlight> |
||
==== [https://www.ghostscript.com/releases/index.html Ghostscript] ==== |
|||
<syntaxhighlight lang="bash"> |
|||
sudo apt update |
|||
sudo apt install ghostscript |
|||
gs --version |
|||
</syntaxhighlight> |
|||
==== php-ImageMagick ==== |
|||
==== [https://www.fluidsynth.org/download/ FluidSynth] ==== |
|||
<syntaxhighlight lang="bash"> |
|||
sudo apt update |
|||
sudo apt install fluidsynth |
|||
fluidsynth --version |
|||
</syntaxhighlight> |
|||
<syntaxhighlight lang="php"> |
<syntaxhighlight lang="php"> |
||
$wgScoreTrim = true; |
|||
wfLoadExtension( 'Scribunto' ); |
|||
$wgImageMagickConvertCommand = '/usr/bin/convert'; |
|||
$wgScribuntoEngineConf['luasandbox']['memoryLimit'] = 50 * 1024 * 1024; |
|||
$wgScoreSafeMode = false; |
|||
$wgScoreLame = '/usr/bin/lame'; |
|||
</syntaxhighlight> |
</syntaxhighlight> |
||
=== [[mw:Extension:PdfHandler|PdfHandler]] === |
|||
==== Composer ==== |
|||
==== Ghostscript ==== |
|||
==== php-imagemagick ==== |
|||
==== [https://pypi.org/project/poppler-utils/#files poppler-utils] ==== |
|||
<syntaxhighlight lang="bash"> |
<syntaxhighlight lang="bash"> |
||
sudo apt update |
|||
composer update --no-dev |
|||
sudo apt install poppler-utils |
|||
pdftotext -v |
|||
</syntaxhighlight> |
|||
<syntaxhighlight lang="php"> |
|||
$wgPdfProcessor = '/usr/bin/gs'; |
|||
$wgPdfPostProcessor = $wgImageMagickConvertCommand; |
|||
$wgPdfInfo = '/usr/bin/pdfinfo'; |
|||
$wgPdftoText = '/usr/bin/pdftotext'; |
|||
</syntaxhighlight> |
</syntaxhighlight> |
||
== 服务器配置 == |
== 服务器配置 == |
||
=== Apache相关 === |
|||
=== Apache 相关 === |
|||
'''禁用防跨站攻击 (open_basedir)''' |
|||
'''启用HTTPS防窜站''' |
|||
''' |
* '''禁用''' 防跨站攻击 (open_basedir) |
||
* '''启用''' HTTPS 防窜站 |
|||
* '''禁用''' TLS 1.0 和 1.1 |
|||
'''伪静态配置''' |
'''伪静态配置''' |
||
<syntaxhighlight lang="apache"> |
<syntaxhighlight lang="apache"> |
||
RewriteEngine On |
RewriteEngine On |
||
| 第137行: | 第205行: | ||
RewriteRule ^(.*)$ /index.php [L,QSA] |
RewriteRule ^(.*)$ /index.php [L,QSA] |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
<syntaxhighlight lang="php"> |
<syntaxhighlight lang="php"> |
||
wfLoadExtension( 'UrlShortener' ); |
wfLoadExtension( 'UrlShortener' ); |
||
$wgUrlShortenerTemplate = '/r/$1'; |
$wgUrlShortenerTemplate = '/r/$1'; |
||
$wgUrlShortenerServer = "false"; |
$wgUrlShortenerServer = "false"; |
||
$wgUrlShortenerEnableQrCode = true; |
$wgUrlShortenerEnableQrCode = true; |
||
$wgUrlShortenerQrCodeShortenLimit = 200; |
$wgUrlShortenerQrCodeShortenLimit = 200; |
||
$actions = [ |
$actions = [ |
||
'view', |
'view', |
||
| 第162行: | 第229行: | ||
'info', |
'info', |
||
]; |
]; |
||
foreach ($actions as $action) { |
foreach ($actions as $action) { |
||
$wgActionPaths[$action] = "/w/$action/$1"; |
$wgActionPaths[$action] = "/w/$action/$1"; |
||
} |
} |
||
$wgActionPaths['view'] = "/w/$1"; |
$wgActionPaths['view'] = "/w/$1"; |
||
$wgArticlePath = $wgActionPaths['view']; |
$wgArticlePath = $wgActionPaths['view']; |
||
| 第173行: | 第238行: | ||
=== SSL === |
=== SSL === |
||
=== Apache安全配置 === |
=== Apache 安全配置 === |
||
<syntaxhighlight lang="apache"> |
<syntaxhighlight lang="apache"> |
||
<Directory /www/wwwroot/lib/images/> |
<Directory /www/wwwroot/lib/images/> |
||
| 第185行: | 第251行: | ||
</syntaxhighlight> |
</syntaxhighlight> |
||
=== MySQL相关 === |
=== MySQL 相关 === |
||
'''官方建议''': |
'''官方建议''': |
||
* 将所有表转为 InnoDB |
|||
* 将所有表转为 |
* 将所有表转为 '''InnoDB''' |
||
* 将所有表转为 <code>utf8mb4</code> |
|||
=== PHP相关 === |
=== PHP相关 === |
||
'''需要启用的插件'''(部分已默认启用) |
|||
'''需要启用的插件'''(部分插件已默认启用) |
|||
<syntaxhighlight lang="bash"> |
<syntaxhighlight lang="bash"> |
||
php -m |
php -m |
||
| 第201行: | 第271行: | ||
'''需要解除禁用的函数''' |
'''需要解除禁用的函数''' |
||
<syntaxhighlight lang="php"> |
<syntaxhighlight lang="php"> |
||
proc_open |
proc_open |
||
| 第208行: | 第279行: | ||
== 站点配置 == |
== 站点配置 == |
||
=== 数据库信息安全 === |
=== 数据库信息安全 === |
||
'''LocalSettings.php''' |
|||
<code>LocalSettings.php</code> |
|||
<syntaxhighlight lang="php"> |
<syntaxhighlight lang="php"> |
||
include(' |
include('/wwwroot/lib.php'); |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
<code>lib.php</code> |
|||
<syntaxhighlight lang="php"> |
<syntaxhighlight lang="php"> |
||
<?php |
<?php |
||
| 第224行: | 第299行: | ||
</syntaxhighlight> |
</syntaxhighlight> |
||
=== 网站Logo === |
=== 网站 Logo === |
||
<syntaxhighlight lang="php"> |
<syntaxhighlight lang="php"> |
||
$wgLogos = [ |
$wgLogos = [ |
||
| 第246行: | 第322行: | ||
=== 移动端皮肤 === |
=== 移动端皮肤 === |
||
<syntaxhighlight lang="php"> |
<syntaxhighlight lang="php"> |
||
$wgDefaultMobileSkin = 'citizen'; |
$wgDefaultMobileSkin = 'citizen'; |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
=== MediaWiki维护脚本 === |
=== MediaWiki 维护脚本 === |
||
<syntaxhighlight lang="bash"> |
<syntaxhighlight lang="bash"> |
||
php maintenance/run.php update.php --quick && \ |
php maintenance/run.php update.php --quick && \ |
||
| 第259行: | 第337行: | ||
php maintenance/run.php cleanupTitles.php --dry-run |
php maintenance/run.php cleanupTitles.php --dry-run |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
== 参见 == |
|||
https://www.mediawiki.org/wiki/Download/zh |
|||
https://www.bt.cn/new/download.html |
|||
https://zh.wikipedia.org/wiki/Wikipedia:%E9%A6%96%E9%A1%B5 |
|||
https://www.mediawiki.org/wiki/Help:Formatting/zh |
|||
https://www.mediawiki.org/wiki/Help:Magic_words/zh |
|||
https://www.mediawiki.org/wiki/Help:Contents/zh |
|||
https://www.mediawiki.org/wiki/Manual:Contents/zh |
|||
https://www.huijiwiki.com/wiki/CommunityCenter |
|||
{{Template:站点帮助文档}} |
{{Template:站点帮助文档}} |
||