二蛋 发布的文章

CentOS7开启BBR加速

先查看系统内核版本,低于4.10的需要先更换内核版本。

uname -r

一、更换内核

导入公钥

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

安装ELRepo 7

yum install https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm -y

安装内核

yum --enablerepo=elrepo-kernel install kernel-ml -y

查看已安装内核

egrep ^menuentry /etc/grub2.cfg | cut -f 2 -d \'

设置内核

- 阅读剩余部分 -

设置SeaCMS支持WebP图片格式

1、允许后台下载WebP格式视频图片到本地
编辑 /include/image.class.php 文件第49行,将

if (strpos("|.jpg|.gif|.png|.bmp|.jpeg|",strtolower($fileext))===false){

修改为

if (strpos("|.jpg|.gif|.png|.bmp|.jpeg|.webp|",strtolower($fileext))===false){

编辑 /include/image.class.php 文件第127行,将

if ($fileext!="" && strpos("|.jpg|.gif|.png|.bmp|.jpeg|",strtolower($fileext))>0){

修改为

if ($fileext!="" && strpos("|.jpg|.gif|.png|.bmp|.jpeg|.webp|",strtolower($fileext))>0){

2、允许后台上传WebP格式视频图片
编辑 /admin/upload.php 文件第48行,将

var $allowExts = array('jpg', 'gif',  'png', 'rar', 'zip', 'bmp');

修改为

var $allowExts = array('jpg', 'gif',  'png', 'rar', 'zip', 'bmp', 'webp');

Linux安装SourceGuardian loader(SG11组件)

SourceGuardian提供php源码文件的加密,而SourceGuardian loader则是提供运行这些加密php文件的php扩展。
一、访问https://www.sourceguardian.com/loaders/download.php
输入服务器上phpinfo函数的php文件地址,如: https://www.2dan.cc/phpinfo.php
二、在线的检测脚本会根据phpinfo里的信息,提取到php的版本信息和扩展路径,并会提示接下来该怎么做。如:
1、下载什么文件ixed.7.4.lin
2、上传到服务器/usr/local/php/lib/php/extensions/no-debug-non-zts-20190902
3、编辑/usr/local/php/etc/php.ini 增加一行extension=ixed.7.4.lin
4、重启php进程

使用Snuffleupagus保护PHP

之前介绍了使用Suhosin保护PHP,由于Suhosin仅支持到php5.x,对于php7.x及以上版本可以试试Snuffleupagus

编译安装:

git clone https://github.com/jvoisin/snuffleupagus
cd snuffleupagus/src
phpize
./configure --with-php-config=/usr/local/php/bin/php-config --enable-snuffleupagus
make
make install

然后在php.ini中引用

[Snuffleupagus]
extension=snuffleupagus.so
sp.configuration_file=/usr/local/php/conf.d/snuffleupagus.rules

其中/usr/local/php/conf.d/snuffleupagus.rules为规则文件,内容可参考:

sp.eval_blacklist.list("base64_decode,system,exec,shell_exec,passthru,proc_open,proc_close, proc_get_status,checkdnsrr,getmxrr,getservbyname,getservbyport, syslog,popen,show_source,highlight_file,dl,socket_listen,socket_create,socket_bind,socket_accept, socket_connect, stream_socket_server, stream_socket_accept,stream_socket_client,ftp_connect, ftp_login,ftp_pasv,ftp_get,sys_getloadavg,disk_total_space, disk_free_space,posix_ctermid,posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname");sp.global.show_old_php_warning.disable();

和Suhosin一样,可以设置函数黑白名单。
更多使用方法参考官网:https://snuffleupagus.readthedocs.io/config.html