VPS主机与服务器★ 4.6 推荐评级

国内服务器WordPress导入主题Demo数据失败的解决方法

博主头像站长评测
发布于 2020/04/19原创独立站体系

今天笔者在给一台国内服务器导入Astra主题的Demo演示数据的时候,因为网络问题,导入了很多次都没能成功。普通情况,我们国内服务器安装好了再使用kill 429或者wp china yes这两个插件就可以实现针对wordpress.org网站的提速,可以安装和更新插件。

但是针对这种特定插件和主题的数据,都不是请求的WordPress官网数据,而是插件和主题自己的网站,国内服务器就很容易出现网络不好的情况安装和导入失败。

想要解决的话有两种办法:

  1. 用国外服务器调试好网站数据后,备份数据恢复到国内服务器;
  2. 给国内服务器上的WordPress设置一个代理服务器,加速国外网站请求。

笔者这里使用的方法是第二种,使用v2raψ作为代理访问。

具体方法如下:

1、购买一台国内服务器访问速度还可以的国外服务器

你可以用自己的服务器ping国外服务器,看ping值大小,一般超过了250ms的线路,可能使用起来也比较卡。

2、在服务器上安装v2raψ

bash <(curl -L -s https://install.direct/go.sh)

安装好了之后,打开/etc/v2raψ/config.json这个编辑文件,记录下里面的:

  • port端口值
  • uuid值

3、国内服务器安装v2raψ

方法和上面代码一样,不过可能下载比较慢,可以参考此文加速Github。

4、修改配置文件/etc/v2raψ/config.json

删除配置文件默认内容,粘贴下面的内容,然后修改中文解释的部分。

{ “log”: { “loglevel”: “warning” }, “inbound”: { “listen”: “127.0.0.1”, “port”: 8080, “protocol”: “http”, “settings”: { “allowTransparent”: false, “userLevel”: 1 } }, “outbound”: { “protocol”: “vmess”, “settings”: { “vnext”: [ { “address”: “168.168.168.168这里改成代理网站IP”, “port”: 8888这里改成代理网站端口, “users”: [ { “id”: “c503b067-e78f-b037-1ac7-7b369103ec9f这里改成代理网站的uuid”, “level”: 1, “alterId”: 64 } ] } ] } }, “outboundDetour”: [ { “protocol”: “freedom”, “settings”: {}, “tag”: “direct” } ], “routing”: { “strategy”: “rules”, “settings”: { “rules”: [ { “type”: “field”, “port”: “54-79”, “outboundTag”: “direct” }, { “type”: “field”, “port”: “81-442”, “outboundTag”: “direct” }, { “type”: “field”, “port”: “444-65535”, “outboundTag”: “direct” }, { “type”: “field”, “domain”: [ “gc.kis.scr.kaspersky-labs.com” ], “outboundTag”: “direct” }, { “type”: “chinasites”, “outboundTag”: “direct” }, { “type”: “field”, “ip”: [ “0.0.0.0/8”, “10.0.0.0/8”, “100.64.0.0/10”, “127.0.0.0/8”, “169.254.0.0/16”, “172.16.0.0/12”, “192.0.0.0/24”, “192.0.2.0/24”, “192.168.0.0/16”, “198.18.0.0/15”, “198.51.100.0/24”, “203.0.113.0/24”, “::1/128”, “fc00::/7”, “fe80::/10” ], “outboundTag”: “direct” }, { “type”: “chinaip”, “outboundTag”: “direct” } ] } } }

配置好之后systemctl restart重启v2raψ服务,不会的话直接重启服务器。

5、编辑WordPress的配置文件,添加上代理配置信息。

/** 代理 */ define(‘WP_PROXY_HOST’, ‘127.0.0.1’); define(‘WP_PROXY_PORT’, ‘8080’); define(‘WP_PROXY_BYPASS_HOSTS’, ‘localhost, *.wordpress.org’);

把WordPress需要访问的国外网址添加到上面第三行位置,保存后上传覆盖。

然后去WordPress后台测试下效果吧,之前无法正常加载的插件资源都可以正常访问了。

参考资料:https://s5s5.me/3721