301和302重定向的区别

详细来说,301和302状态码都表示重定向,就是说浏览器在拿到服务器返回的这个状态码后会自动跳转到一个新的URL地址,这个地址可以从响应的Location首部中获取(用户看到的效果就是他输入的地址A瞬间变成了另一个地址B)——这是它们的共同点。他们的不同在于。301表示旧地址A的资源已经被永久地移除了(这个资源不可访问了),搜索引擎在抓取新内容的同时也将旧的网址交换为重定向之后的网址;302表示旧地址A的资源还在(仍然可以访问),这个重定向只是临时地从旧地址A跳转到地址B,搜索引擎会抓取新的内容而保存旧的网址。

Read More

Redis内存溢出后报错的解决办法

故障简介

早上查看Redis日志的时候发现一直在报错

1
2
[1524] 24 Mar 10:00:56.037 * 1 changes in 900 seconds. Saving...
[1524] 24 Mar 10:00:56.037 # Can't save in background: fork: Cannot allocate memory

php程序的错误日志

1
Exception: MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error. 

Read More

php-fpm 与 Nginx优化总结

php-fpm参数概述

php-fpm的配置文件在Ubuntu系统中的路径是/etc/php/7.4/fpm/pool.d/www.conf,下面对每个参数的意义进行简要的概述分析。

pm=dynamic

该项共有三种设置方式 static 、 dynamic 、ondemand

Read More