wordpress 多站点独立域名配置

wordpress 多站点独立域名配置
把wordpress 的多站点的独立域名设置学会了,可以通过配置一套wordpress 程序,建立多个站点并且绑定独立域名了,这个问题之前一直没有学会设置,设置过几次也没有成功,现在趁着有感觉好好看了一下教程学会了设置。
把5656t.com 的 wordpress 都设置成了多站点可以绑定独立域名形式。尝试一下 http://stevepavlina.cn/ 现在是跳转到了默认域名 1.5656t.com,设置好https证书后就可以切换主访问域名为 https://stevepavlina.cn。这样就完成了独立域名绑定。(已完成配置可以直接访问了。)

主要的步骤也记录一下。
升级好wordpress, 配置wordpress的多站点:

设置多站点:(有中文版本)
https://codex.wordpress.org/Create_A_Network
https://codex.wordpress.org/zh-cn:%E5%88%9B%E5%BB%BA%E7%AB%99%E7%82%B9%E7%BD%91%E7%BB%9C

配置多站点独立域名的设置(Nginx):
https://codex.wordpress.org/Nginx

按照:多站点,独立域名插件WordPress MU Domain Mapping
1.在网络中启用插件;
2.复制文件到 sunrise.php 到 wp-content/.

  1. Install the plugin in the usual way into the regular WordPress plugins folder. Network activate the plugin.
  1. Move sunrise.php into wp-content/. If there is a sunrise.php there already, you’ll just have to merge them as best you can.
  1. Edit wp-config.php and uncomment or add the SUNRISE definition line. If it does not exist please ensure it’s on the line above the last “require_once” command. define( ‘SUNRISE’, ‘on’ );
  1. As a “super admin”, visit Super Admin->Domain Mapping to create the domain mapping database table and set the server IP address or a domain to point CNAME records at.
  1. Make sure the default Apache virtual host points at your WordPress MU site or WordPress 3.0 network so it will handle unknown domains correctly. On some hosts you may be required to get a dedicated IP address. A quick check: in a web broswer, type in the IP address of your install. If you are using CPanel, use the Park a Domain menu to set the mapped domain to your main installtion.
  1. Do not define COOKIE_DOMAIN in your wp-config.php as it conflicts with logins on your mapped domains.

Illustrated installation instructions can be found here but you can ignore the instructions to place domain_mapping.php in mu-plugins. Thanks Otto.

把你的通用二级域名的 * 通配符 解析到站点服务器,nginx 也加入统配解析。再增加站点也无需增加nginx 配置和修改。
如果是自定义域名设置你不想麻烦就把 nginx 的默认域名改为wordpress 的目录和配置,新域名绑定可以直接解析过来,不需要再修改nginx 配置,如果你为了安全也可以每次新增域名手动在nginx 配置中增加,重新加载配置。

注意 https 和 http 要一起配置才好。还没有学会如何在一个配置中配置多个域名证书。
如果你要做对外服务,启用https 需要考虑通用域的证书。要不然配置和申请证书工作量太大了。

设置完成以后就可以在仪表盘或者网络管理中给子站点配置独立域名了。

以后想开 wordpress 站点,不需要再一套一套的安装了,只需要新建站点即可完成。

越用越发现大家说好的软件真的很厉害,wordpress.com的云端设计理念和独立软件wordpress设计思想都很值得学习借鉴。