跳至內容
主選單
主選單
移至側邊欄
隱藏
导航
首页
最近更改
随机条目
特殊页面
站点
关于陋室
维基社群
新闻动态
联系我们
活跃用户
统计
参与
上传文件
待撰页面
新建页面
编辑入门
帮助
内容
分类树
所有页面
前缀索引
最多链入页面
热门页面
维护
MediaWiki 消息页
系统消息
小工具管理
小工具定义
用户组权限
界面
侧边栏
英文侧边栏
站点公告
匿名用户通知
公共样式表
公共脚本
陋室
搜尋
搜尋
中文(繁體)
外觀
登入
個人工具
登入
沙盒
檢視Help:MediaWiki安装指南的原始碼
說明
討論
繁體
不转换
简体
繁體
大陆简体
香港繁體
澳門繁體
大马简体
新加坡简体
臺灣正體
閱讀
檢視原始碼
檢視歷史
工具
工具
移至側邊欄
隱藏
操作
閱讀
檢視原始碼
檢視歷史
一般
連結至此的頁面
相關變更
頁面資訊
Cargo 資料
取得短連結
外觀
移至側邊欄
隱藏
←
Help:MediaWiki安装指南
您沒有權限執行編輯此頁面,由於以下原因:
您請求的操作只有這些群組的使用者能使用:
使用者
、
自動確認使用者
您可以檢視並複製此頁面的原始碼。
这个页面介绍了本站的 [[mw:Download|MediaWiki]] 的安装笔记. == 服务器配置 == '''服务器提供商''': [https://cloud.tencent.com/ 腾讯云]-轻量云(轻量应用服务器) '''地域和可用区''': 新加坡 | 新加坡一区 '''实例规格''': * '''CPU''': 2 核 * '''内存''': 2GB * '''系统盘''': SSD 云硬盘 50GB * '''流量包''': 1024GB/月(峰值带宽 30Mbps) == 服务器环境 == === 操作系统 === '''镜像名称''': [https://www.debian.org/distrib/ Debian] '''操作系统''': Debian 12.0 64bit <syntaxhighlight lang="bash"> cat /etc/os-release sudo apt update sudo apt upgrade </syntaxhighlight> === 服务器软件 === * '''[https://www.bt.cn/new/download.html 宝塔Linux面板]''' : 正式版 9.4.0 <syntaxhighlight lang="bash"> wget -O install_panel.sh https://download.bt.cn/install/install_panel.sh && bash install_panel.sh ed8484bec </syntaxhighlight> * '''Apache [https://httpd.apache.org/download.cgi httpd] 2.4.62 (PHP+fpm)''' <syntaxhighlight lang="bash"> which apache2 apache2 -v </syntaxhighlight> * '''[https://dev.mysql.com/downloads/windows/installer/ MySQL 5.7.44]'''(MediaWiki 最低要求 5.7,大内存机器首选 8.0+,官方推荐 MongoDB) <syntaxhighlight lang="bash"> which mysql systemctl status mysql </syntaxhighlight> * '''[https://www.php.net/downloads.php PHP] 8.2.27'''(MediaWiki 最低要求 8.1) <syntaxhighlight lang="bash"> which php php -v </syntaxhighlight> * '''[https://www.phpmyadmin.net/downloads/ phpMyAdmin] 5.2'''(可通过宝塔安装) == 服务器依赖 == === php-[[mw:Wikidiff2|wikidiff2]] === <syntaxhighlight lang="bash"> apt-get install php-wikidiff2 find /usr/lib/ -name wikidiff2.so nano /www/server/php/82/etc/php.ini extension=/usr/lib/php/20220829/wikidiff2.so php -m | grep wikidiff2 </syntaxhighlight> <syntaxhighlight lang="php"> $wgDiffEngine = "wikidiff2"; $wgDiff3 = "/usr/bin/diff3"; </syntaxhighlight> === php-[https://www.mediawiki.org/wiki/LuaSandbox luasandbox] === <syntaxhighlight lang="bash"> sudo apt update sudo apt install php-luasandbox -y 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 lang="php"> wfLoadExtension( 'Scribunto' ); $wgScribuntoEngineConf['luasandbox']['memoryLimit'] = 50 * 1024 * 1024; </syntaxhighlight> === [https://ffmpeg.org/download.html ffmpeg] 6.1(可通过宝塔安装) === <syntaxhighlight lang="bash"> which ffmpeg ffmpeg -version </syntaxhighlight> === [https://getcomposer.org/download/ Composer] === <syntaxhighlight lang="bash"> composer update --no-dev </syntaxhighlight> == MediaWiki 插件依赖 == === [[mw:Extension:EasyTimeline|EasyTimeline]] === ==== [https://ploticus.sourceforge.net/doc/download.html Ploticus] ==== <syntaxhighlight lang="bash"> sudo apt update sudo apt install ploticus ploticus -version </syntaxhighlight> ==== [https://www.perl.org/get.html perl] ==== <syntaxhighlight lang="bash"> sudo apt update sudo apt install perl perl -v </syntaxhighlight> <syntaxhighlight lang="php"> $wgTimelinePloticusCommand = '/usr/bin/ploticus'; $wgTimelinePerlCommand = "/usr/bin/perl"; $wgTimelineFontDirectory = "/usr/share/fonts/truetype/freefont"; $wgTimelineFontFile = 'ascii'; </syntaxhighlight> === [[mw:Extension:Score|Score]] === ==== [https://lilypond.org/ LilyPond] ==== <syntaxhighlight lang="bash"> sudo apt update sudo apt install lilypond lilypond --version </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"> $wgScoreTrim = true; $wgImageMagickConvertCommand = '/usr/bin/convert'; $wgScoreSafeMode = false; $wgScoreLame = '/usr/bin/lame'; </syntaxhighlight> === [[mw:Extension:PdfHandler|PdfHandler]] === ==== Ghostscript ==== ==== php-imagemagick ==== ==== [https://pypi.org/project/poppler-utils/#files poppler-utils] ==== <syntaxhighlight lang="bash"> sudo apt update 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> == 服务器配置 == === Apache 相关 === * '''禁用''' 防跨站攻击 (open_basedir) * '''启用''' HTTPS 防窜站 * '''禁用''' TLS 1.0 和 1.1 '''伪静态配置''' <syntaxhighlight lang="apache"> RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteCond %{REQUEST_URI} !\.(css|js|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|less)$ [NC] RewriteCond %{REQUEST_URI} !^/load.php [NC] RewriteCond %{REQUEST_URI} !^/api.php [NC] RewriteRule ^w/(.*)$ /index.php?title=$1 [L,QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php [L,QSA] </syntaxhighlight> <syntaxhighlight lang="php"> wfLoadExtension( 'UrlShortener' ); $wgUrlShortenerTemplate = '/r/$1'; $wgUrlShortenerServer = "false"; $wgUrlShortenerEnableQrCode = true; $wgUrlShortenerQrCodeShortenLimit = 200; $actions = [ 'view', 'edit', 'watch', 'unwatch', 'delete', 'revert', 'rollback', 'protect', 'unprotect', 'markpatrolled', 'render', 'submit', 'history', 'purge', 'info', ]; foreach ($actions as $action) { $wgActionPaths[$action] = "/w/$action/$1"; } $wgActionPaths['view'] = "/w/$1"; $wgArticlePath = $wgActionPaths['view']; </syntaxhighlight> === SSL === === Apache 安全配置 === <syntaxhighlight lang="apache"> <Directory /www/wwwroot/lib/images/> Options -ExecCGI -Indexes AllowOverride None <FilesMatch "\.(php|php5|pl|py|jsp|asp|htm|html|cgi|sh)$"> Require all denied </FilesMatch> Header always set X-Content-Type-Options "nosniff" </Directory> </syntaxhighlight> === MySQL 相关 === '''官方建议''': * 将所有表转为 '''InnoDB''' * 将所有表转为 <code>utf8mb4</code> === PHP相关 === '''需要启用的插件'''(部分插件已默认启用) <syntaxhighlight lang="bash"> php -m </syntaxhighlight> <syntaxhighlight lang="php"> Core date libxml openssl pcre sqlite3 zlib bcmath ctype curl dom filter ftp gd gettext hash iconv intl json mbstring SPL session pcntl standard mysqlnd PDO pdo_mysql pdo_sqlite Phar posix random Reflection mysqli shmop SimpleXML soap sockets sodium sysvsem tokenizer xml xmlreader xmlwriter wikidiff2 luasandbox zip imagick fileinfo apcu exif calendar </syntaxhighlight> '''需要解除禁用的函数''' <syntaxhighlight lang="php"> proc_open popen putenv </syntaxhighlight> == 站点配置 == === 数据库信息安全 === <code>LocalSettings.php</code> <syntaxhighlight lang="php"> include('/wwwroot/lib.php'); </syntaxhighlight> <code>lib.php</code> <syntaxhighlight lang="php"> <?php $wgDBserver = 'localhost'; $wgDBname = ''; $wgDBuser = ''; $wgDBpassword = ''; ?> </syntaxhighlight> === 网站 Logo === <syntaxhighlight lang="php"> $wgLogos = [ '1x' => "$wgResourceBasePath/Libary-4l.png", 'icon' => "$wgResourceBasePath/Libary-4l.png", ]; $wgFavicon = "$wgResourceBasePath/images/logos/Libary-4l.png"; $wgAppleTouchIcon = "$wgResourceBasePath/images/logos/Libary-4l.png"; $wgFooterIcons['logo'] = [ 'yourcustomicon' => [ 'src' => '/images/logos/Libary-1ll.png ', 'url' => $wgServer, 'alt' => 'Logo', 'height' => '31', 'width' => '68', ], ]; </syntaxhighlight> === 移动端皮肤 === <syntaxhighlight lang="php"> $wgDefaultMobileSkin = 'citizen'; </syntaxhighlight> === MediaWiki 维护脚本 === <syntaxhighlight lang="bash"> php maintenance/run.php update.php --quick && \ php maintenance/run.php rebuildrecentchanges.php && \ php maintenance/run.php rebuildall.php && \ php maintenance/run.php rebuildtextindex.php && \ php maintenance/run.php refreshLinks.php && \ php maintenance/run.php cleanupTitles.php --dry-run </syntaxhighlight> {{Template:站点帮助文档}}
此頁面嵌入了以下幾個頁面:
Template:Navbox
(
檢視原始碼
)
Template:Navbox/styles.css
(
檢視原始碼
)
Template:PageToolsLink
(
檢視原始碼
)
Template:PageToolsLink/styles.css
(
檢視原始碼
)
Template:站点帮助文档
(
檢視原始碼
)
Module:Navbox
(
檢視原始碼
)
Module:PageToolsLink
(
檢視原始碼
)
返回到「
Help:MediaWiki安装指南
」。
搜尋
搜尋
檢視Help:MediaWiki安装指南的原始碼
新增語言
新增話題