Skip to content

A Wikimedia Projects Reverse Proxy based on Nginx

License

Notifications You must be signed in to change notification settings

librarycloud/nginx-wikimirror

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nginx-wikimirror

A Wikimedia Projects Reverse Proxy based on Nginx

使用方法 | Instructions for Use

  1. 将文件夹nginx-wikimirrorRelease)下载至本地,并保持目录结构,不要直接克隆仓库
    Download the release of nginx-wikimirror, maintaining the directory structure, and DO NOT clone the repository directly
  2. 将文件夹nginx-wikimirror重命名为wikimirror,并记录此时的绝对路径
    Rename the folder nginx-wikimirror to wikimirror and record the absolute path
  3. 重编译Nginx以添加ngx_http_substitutions_filter_moduleheaders-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后,一级目录中,除confstatic之外的文件即无用,可自行处置
After configuring the SSL certificate, DNS resolution, and Nginx, any files in the top-level directory except for conf and static are no longer needed and can be disposed of at your discretion

  • DNS Name.txt

    假设你的域名为example.org——你SSL证书的DNS可选名称需要包含这些域名
    Assuming your domain is example.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 is example.org and your IP is 127.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
    Replace example.org with your domain

  • conf/wiki.nginx

    用你的绝对路径替换/path/to/wikimirror
    Replace /path/to/wikimirror with your absolute path

    用你的域名替换example.org
    Replace example.org with your domain

    假设你的域名为test.com,则用你的域名替换example\.orgtest\.com;假设你的域名为test.com.cn,则用你的域名替换example\.orgtest\.com\.cn
    Assuming your domain is test.com, replace example\.org with test\.com. Assuming your domain is test.com.cn, replace example\.org with test\.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
    Replace example.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\.orgtest\.com;假设你的域名为test.com.cn,则用你的域名替换example\.orgtest\.com\.cn
    Assuming your domain is test.com, replace example\.org with test\.com. Assuming your domain is test.com.cn, replace example\.org with test\.com\.cn

  • static/wikimirror.js

    用你的域名替换example.org
    Replace example.org with your domain

问答 | Q&A

  • 包括但不限于CDN、DNS、SSL、Nginx其他的配置等“额外的东西”怎么弄?
    How to configure "extra things" such as CDN, DNS, SSL, other Nginx configurations, etc.?

    不要问我,问Google
    Don't ask me, ask Google

  • 为什么路径、域名等“可变的东西”不用变量?
    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 many include?

      因为Nginx的include只会在每次运行前载入一次,不会影响性能
      Because Nginx's include 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_typesgzip_types配置项
    MediaWiki sometimes responds with its special mime-type text/x-wiki. If you use Brotil or Gzip compression, you can adjust the brotli_types or gzip_types configuration options accordingly
  • TypeScript version of wikimirror.js

Star History Chart

About

A Wikimedia Projects Reverse Proxy based on Nginx

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published