Bye,2016;Hi,2017!
今天是2016年12月31日,2016年的最后一天了,昨天开始折腾了下博客的动静分离,一直懒的折腾,趁着放假折腾一下。SourceByrd's Weblog-https://note.t4x.org/other/wordpress-movement-separation/
动静分离主要目的是将所有静态的资源由CDN来完成应答,减少网站服务器本身的压力。SourceByrd's Weblog-https://note.t4x.org/other/wordpress-movement-separation/
配置方法如下:
0 1 2 3 4 5 6 7 8 9 10 11 |
1:解决cookies,我这里暂时没有解决。 [root@www site]# grep "COOKIE_DOMAIN" wp-config.php define('COOKIE_DOMAIN', 'note.t4x.org'); 2:定义要进行转跳的域名以及文件类型 [root@www begin]# head -7 functions.php |tail -6 #当前所有模板的functions.php,我用的知更鸟的模板 //static ob_start("Static_Switch"); function Static_Switch($buffer){ $buffer_out = preg_replace('/https:\/\/www\.t4x\.org\/wp-([^"\']*?)\.(gif|jpg|jpeg|png|bmp|js|css|woff|woff2|ttf|svg|eot)/i','https://static.t4x.org/wp-$1.$2',$buffer); return $buffer_out; } 3:静态域名请求index.php的时候转跳到note.t4x.org即可。 |
免费支持HTTPS的CDN:SourceByrd's Weblog-https://note.t4x.org/other/wordpress-movement-separation/
1:http://www.mmtrix.com/user/register?recmdBy=87602
2:https://www.verycloud.cn/cloud/cdninfoSourceByrd's Weblog-https://note.t4x.org/other/wordpress-movement-separation/
参考文档:
1:https://zhangge.net/5047.htmlSourceByrd's Weblog-https://note.t4x.org/other/wordpress-movement-separation/
SourceByrd's Weblog-https://note.t4x.org/other/wordpress-movement-separation/