WishMeLz

生活其实很有趣

Typecho 转移记录

2023-2-4

配置sitemap.xml

https://github.com/jozhn/Sitemap-for-Typecho

投送谷歌 https://search.google.com/ 报错:无法读取此站点地图

2023-02-04T05:45:25.png

2023-01-30

typecho使用七牛云CDN

cdn配置:https://blog.itsse.cn/481.html

post.php
<?php $this->content(); ?>
改为
<?php echo $str = str_replace("cdn.itsse.cn/usr/uploads","cdn.itsse.cn/usr/uploads",$this->content); ?>

2023-01-30T05:20:10.png

或者用这个插件 https://github.com/Quarkay/Typecho-SimpleCDN

文章置顶

<?php  $this->sticky(); ?>

2023-01-30T05:40:30.png

预加载

https://instant.page/

wget https://raw.githubusercontent.com/instantpage/instant.page/master/instantpage.js;

nginx配置

location ~ .*\.(gif|jpg|jpeg|png)$ {
        add_header Cache-Control "no-cache"; # 缓存协商验证
        add_header Vary "Accept-Encoding";
        try_files $uri$webp_suffix $uri =404;
        access_log off;
        }

        ## JS/CSS 静态文件
        location ~ .*\.(js|css)$ {
        add_header Cache-Control "no-cache"; # 缓存协商验证
        add_header Vary "Accept-Encoding";
        access_log off;
        }

TpCache缓存插件

https://github.com/phpgao/TpCache

出现无法启用插件的情况下

chown -R www:www xxx/
chmod 755 xxx/

 

服务器监听

https://day.app/2018/06/bark-server-document/

## CPU负载计算

function GetSysCPU 
{
CpuIdle=`vmstat 1 5 |sed -n '3,$p' | awk '{x = x + $15} END {print x/5}' | awk -F. '{print $1}'` 
CpuNum=`echo "100-$CpuIdle" | bc` 
echo $CpuNum 
}

cpucheck=`GetSysCPU`
cpumax=50

## 判断当前CPU负载是否超过阈值cpumax

if [ ${cpucheck} -gt $max ];
then
date=$(env LANG=en_US.UTF-8 date "+%e/%b/%Y/%R")
curl -X POST "https://api.day.app/[token]/服务器异常/$date%0aCPU负载为$cpucheck%%0a注意及时检查"
else

##监测坚果输出到本地以便后期查阅..

date=$(env LANG=en_US.UTF-8 date "+%e/%b/%Y/%R")
echo "${date}" "CPU负载正常,当前负载为$cpucheck%..." >> /home/cpucheck.log 
fi