A Wikimedia Projects Reverse Proxy based on Nginx
使用方法 | Instructions for Use
- 将文件夹
nginx-wikimirror
(Release)下载至本地,并保持目录结构,不要直接克隆仓库
Download the release ofnginx-wikimirror
, maintaining the directory structure, and DO NOT clone the repository directly - 将文件夹
nginx-wikimirror
重命名为wikimirror
,并记录此时的绝对路径
Rename the foldernginx-wikimirror
towikimirror
and record the absolute path - 重编译Nginx以添加ngx_http_substitutions_filter_module和headers-more-nginx-module
Rebuild Nginx to add ngx_http_substitutions_filter_module and headers-more-nginx-module
需要你自行修改的位置 | Locations that need to be modified manually
在你配置完SSL证书、DNS解析和Nginx后,一级目录中,除
conf
和static
之外的文件即无用,可自行处置
After configuring the SSL certificate, DNS resolution, and Nginx, any files in the top-level directory except forconf
andstatic
are no longer needed and can be disposed of at your discretion
-
DNS Name.txt
假设你的域名为
example.org
——你SSL证书的DNS可选名称需要包含这些域名
Assuming your domain isexample.org
, your SSL certificate's DNS alternative name should include these domains -
DNS.zone
假设你的域名为
example.org
,你的IP为127.0.0.1
——你域名的DNS解析需要包含这些记录
Assuming your domain isexample.org
and your IP is127.0.0.1
, your DNS resolution needs to include these records -
nginx.conf
修改L-27
/path/to/wikimirror
为你的绝对路径,补全...
——这仅是一份包含必要配置项的Nginx配置文件
Modify L-27/path/to/wikimirror
to your absolute path and complete...
, this is just an Nginx configuration file containing necessary configuration options
下文的“替换”,如无特殊强调,均为全局搜索并替换
The "replace" used in the following text refers to a global search and replace, unless otherwise specified
-
conf/wiki.conf
用你的域名替换
example.org
Replaceexample.org
with your domain -
conf/wiki.nginx
用你的绝对路径替换
/path/to/wikimirror
Replace/path/to/wikimirror
with your absolute path用你的域名替换
example.org
Replaceexample.org
with your domain假设你的域名为
test.com
,则用你的域名替换example\.org
为test\.com
;假设你的域名为test.com.cn
,则用你的域名替换example\.org
为test\.com\.cn
Assuming your domain istest.com
, replaceexample\.org
withtest\.com
. Assuming your domain istest.com.cn
, replaceexample\.org
withtest\.com\.cn
用你存放SSL证书的路径替换L-33、L-34、L-35、L-75、L-76、L-77的
/path/to
Replace/path/to
with the path where your SSL certificate files are stored in the following lines: L-33, L-34, L-35, L-75, L-76, L-77在L-6~L-11和L-15~L-20中分别选择一个距离服务器所在地区最近的或从服务器访问速度最快的节点IP,删掉它所在那行最前面的
#
In L-6~L-11 and L-15~L-20, choose an IP address of a node that is closest to the location of your server or has the fastest access speed from the server, and delete the#
at the beginning of the corresponding line -
conf/wiki-location-api.conf、conf/wiki-location-main.conf、conf/wiki-location-static.conf
用你的绝对路径替换
/path/to/wikimirror
Replace/path/to/wikimirror
with your absolute path -
conf/wiki-location-upload-fix.conf
用你的域名替换
example.org
Replaceexample.org
with your domain -
conf/wiki-site-ssl.conf
用你存放SSL证书的路径替换
/path/to
Replace/path/to
with the path where your SSL certificate files are stored -
conf/wiki-sub.conf
用你的域名替换
example.org
,注意以下行:L-22
Replace example.org with your domain. Note the following line: L-22假设你的域名为
test.com
,则用你的域名替换example\.org
为test\.com
;假设你的域名为test.com.cn
,则用你的域名替换example\.org
为test\.com\.cn
Assuming your domain istest.com
, replaceexample\.org
withtest\.com
. Assuming your domain istest.com.cn
, replaceexample\.org
withtest\.com\.cn
-
static/wikimirror.js
用你的域名替换
example.org
Replaceexample.org
with your domain
问答 | Q&A
-
包括但不限于CDN、DNS、SSL、Nginx其他的配置等“额外的东西”怎么弄?
How to configure "extra things" such as CDN, DNS, SSL, other Nginx configurations, etc.? -
为什么路径、域名等“可变的东西”不用变量?
Why not use variables for the "variable things" like path and domain?因为Nginx在处理每一个请求前都需要对变量重新赋值,这会影响性能
Because Nginx needs to reassign variables for each request it processes, which can affect performance-
那怎么一堆
include
?
Why so manyinclude
?因为Nginx的
include
只会在每次运行前载入一次,不会影响性能
Because Nginx'sinclude
only loads files once before each run, it does not affect performance
-
-
支持的浏览器有哪些?
Supported Browsers参见MediaWiki浏览器兼容性表格的Grade A行
See MediaWiki browser support matrix - Grade A
提示 | Tips
- MediaWiki有时会响应其特殊的mime-type类型
text/x-wiki
,如果你使用Brotil或Gzip压缩,可以酌情调整brotli_types
或gzip_types
配置项
MediaWiki sometimes responds with its special mime-typetext/x-wiki
. If you use Brotil or Gzip compression, you can adjust thebrotli_types
orgzip_types
configuration options accordingly - TypeScript version of wikimirror.js