当前位置:首页>Linux>防患于未然:Linux系统安全加固实战宝典 - 运维工程师必备技能

防患于未然:Linux系统安全加固实战宝典 - 运维工程师必备技能

  • 2026-02-05 01:02:50
防患于未然:Linux系统安全加固实战宝典 - 运维工程师必备技能

关注「Raymond运维」公众号,并设为「星标」,也可以扫描底部二维码加入群聊,第一时间获取最新内容,不再错过精彩内容。

防患于未然:Linux系统安全加固实战宝典 

在数字化浪潮席卷全球的今天,网络安全威胁如影随形。据统计,90%的网络攻击都是从系统漏洞和配置不当开始的。作为运维工程师,我们不仅要让系统跑得稳定,更要让它固若金汤。今天,我将分享多年实战经验中总结的Linux系统安全加固技巧,让你的服务器从"裸奔"状态升级为"铜墙铁壁"。

安全威胁现状:你的Linux真的安全吗?

常见安全威胁类型

现代Linux系统面临的主要威胁包括:

暴力破解攻击:SSH、FTP等服务的密码爆破权限提升攻击:利用内核漏洞获取root权限恶意软件感染:木马、后门、挖矿程序等数据泄露风险:敏感文件权限配置不当DDoS攻击:资源耗尽型攻击

安全防护的三道防线

ounter(lineounter(lineounter(line第一道防线:系统层防护(用户管理、权限控制、服务加固)第二道防线:网络层防护(防火墙、端口管理、流量监控)第三道防线:应用层防护(日志审计、入侵检测、应急响应)

用户账户安全:筑牢第一道防线

1. 用户账户管理最佳实践

禁用不必要的系统账户

ounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(line#!/bin/bash# 禁用系统不需要的账户USERS_TO_DISABLE="games news uucp operator gopher"for user in $USERS_TO_DISABLE;doif id "$user">/dev/null2>&1;then        usermod -L "$user"        usermod -s /sbin/nologin "$user"        echo "已禁用账户: $user"fidone# 检查空密码账户awk -F:'($2 == "") {print "警告: " $1 " 账户密码为空"}'/etc/shadow

创建安全的管理员账户

ounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(line# 创建具有sudo权限的普通用户useradd -m -s /bin/bash -G wheel secadminpasswd secadmin# 配置sudo免密(谨慎使用)echo "secadmin ALL=(ALL) NOPASSWD:ALL">>/etc/sudoers.d/secadminchmod 440/etc/sudoers.d/secadmin

2. 密码策略强化

配置强密码策略

ounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(line# /etc/login.defs 密码策略配置PASS_MAX_DAYS   90# 密码最大有效期PASS_MIN_DAYS   7# 密码最小更改间隔PASS_MIN_LEN    12# 最小密码长度PASS_WARN_AGE   14# 密码过期警告天数# 安装并配置 pam_pwqualityyum install -y libpwqualityecho "password requisite pam_pwquality.so retry=3 minlen=12 dcredit=-1 ucredit=-1 ocredit=-1 lcredit=-1">>/etc/pam.d/system-auth

账户锁定策略

ounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(line# 配置登录失败锁定cat >>/etc/pam.d/sshd << EOFauth required pam_tally2.so deny=5 unlock_time=300 even_deny_root root_unlock_time=300account required pam_tally2.soEOF# 查看被锁定的账户pam_tally2 --user=username# 解锁账户pam_tally2 --user=username --reset

SSH安全加固:关闭危险之门

1. SSH配置安全优化

核心安全配置

ounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(line# /etc/ssh/sshd_config 安全配置Port2022# 更改默认端口Protocol2# 使用SSH协议版本2PermitRootLoginno# 禁止root直接登录PasswordAuthenticationno# 禁用密码认证PubkeyAuthentication yes           # 启用公钥认证AuthorizedKeysFile.ssh/authorized_keysMaxAuthTries3# 最大认证尝试次数MaxSessions2# 最大会话数ClientAliveInterval300# 客户端存活检测间隔ClientAliveCountMax2# 最大存活检测次数AllowUsers secadmin developer      # 仅允许特定用户登录DenyUsers root guest               # 拒绝特定用户登录

2. SSH密钥认证配置

生成和部署SSH密钥

ounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(line# 在客户端生成密钥对ssh-keygen -t ed25519 -b 4096-f ~/.ssh/id_ed25519 -N ""# 复制公钥到服务器ssh-copy-id -i ~/.ssh/id_ed25519.pub secadmin@server_ip# 服务器端设置正确权限chmod 700~/.sshchmod 600~/.ssh/authorized_keyschown -R secadmin:secadmin ~/.ssh

SSH连接监控脚本

ounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(line#!/bin/bash# SSH登录监控和告警脚本LOG_FILE="/var/log/secure"ALERT_EMAIL="admin@company.com"# 监控SSH登录失败tail -f $LOG_FILE |while read line;doif echo "$line"| grep -q "Failed password";then        IP=$(echo "$line"| awk '{print $11}')        USER=$(echo "$line"| awk '{print $9}')        echo "SSH登录失败: $USER from $IP"| mail -s "SSH Security Alert" $ALERT_EMAIL# 自动封禁多次失败的IP        FAIL_COUNT=$(grep "Failed password" $LOG_FILE | grep "$IP"wc -l)if$FAIL_COUNT -gt 5];then            iptables -A INPUT -s $IP -j DROP            echo "已封禁IP: $IP"fifidone

防火墙配置:构建网络防护屏障

1. iptables防火墙规则

基础防火墙脚本

ounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(line#!/bin/bash# iptables安全配置脚本# 清空现有规则iptables -Fiptables -Xiptables -t nat -Fiptables -t nat -X# 设置默认策略iptables -P INPUT DROPiptables -P FORWARD DROPiptables -P OUTPUT ACCEPT# 允许本地回环iptables -A INPUT -i lo -j ACCEPTiptables -A OUTPUT -o lo -j ACCEPT# 允许已建立的连接iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT# 允许SSH(自定义端口)iptables -A INPUT -p tcp --dport 2022-j ACCEPT# 允许HTTP和HTTPSiptables -A INPUT -p tcp --dport 80-j ACCEPTiptables -A INPUT -p tcp --dport 443-j ACCEPT# 防DDoS规则iptables -A INPUT -p tcp --dport 80-m limit --limit 25/minute --limit-burst 100-j ACCEPT

2. firewalld现代防火墙管理

firewalld配置示例

ounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(line# 启用firewalldsystemctl enable --now firewalld# 配置默认区域firewall-cmd --set-default-zone=public# 添加服务规则firewall-cmd --permanent --zone=public--add-service=sshfirewall-cmd --permanent --zone=public--add-service=httpfirewall-cmd --permanent --zone=public--add-service=https# 自定义端口规则firewall-cmd --permanent --zone=public--add-port=2022/tcp# 限制SSH访问源firewall-cmd --permanent --zone=public--add-rich-rule='rule family="ipv4" source address="192.168.1.0/24" service name="ssh" accept'# 重载配置firewall-cmd --reload

文件系统安全:保护数据资产

1. 文件权限管理

关键文件权限检查脚本

ounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(line#!/bin/bash# 系统关键文件权限检查check_file_permissions(){local file=$1local expected_perm=$2local current_perm=$(stat -c "%a""$file"2>/dev/null)if["$current_perm"!="$expected_perm"];then        echo "警告: $file 权限异常,当前: $current_perm, 期望: $expected_perm"        chmod $expected_perm "$file"        echo "已修复: $file 权限设置为 $expected_perm"fi}# 检查关键系统文件权限check_file_permissions "/etc/passwd""644"check_file_permissions "/etc/shadow""600"check_file_permissions "/etc/group""644"check_file_permissions "/etc/gshadow""600"check_file_permissions "/etc/ssh/sshd_config""600"# 查找危险权限文件find /-type f \( -perm -4000-o -perm -2000 \) -exec ls -lg {} \; 2>/dev/null| head -20

2. 磁盘加密和挂载安全

磁盘挂载安全选项

ounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(line# /etc/fstab 安全挂载选项/dev/sda1 /home ext4 defaults,nodev,nosuid,noexec 02/dev/sda2 /tmp ext4 defaults,nodev,nosuid,noexec 02/dev/sda3 /var/log ext4 defaults,nodev,nosuid,noexec 02# 创建加密分区cryptsetup luksFormat /dev/sdb1cryptsetup luksOpen /dev/sdb1 encrypted_diskmkfs.ext4 /dev/mapper/encrypted_disk

服务安全加固:减少攻击面

1. 服务管理和端口控制

服务安全检查脚本

ounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(line#!/bin/bash# 服务安全检查和加固脚本# 停用不必要的服务DISABLE_SERVICES="telnet rsh rlogin ypbind tftp talk ntalk"for service in $DISABLE_SERVICES;doif systemctl is-enabled $service >/dev/null2>&1;then        systemctl disable --now $service        echo "已停用服务: $service"fidone# 检查监听端口echo "=== 当前监听端口 ==="netstat -tlnp | grep LISTEN# 检查运行的服务echo "=== 运行中的服务 ==="systemctl list-units --type=service --state=running | grep -v "systemd"

2. Web服务器安全配置

Nginx安全配置示例

ounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(line# /etc/nginx/nginx.conf 安全配置http {# 隐藏版本信息    server_tokens off;# 安全头设置    add_header X-Frame-Options DENY;    add_header X-Content-Type-Options nosniff;    add_header X-XSS-Protection"1; mode=block";    add_header Strict-Transport-Security"max-age=31536000; includeSubDomains";# 限制请求大小    client_max_body_size 10M;    client_body_buffer_size 128k;# 连接限制    limit_conn_zone $binary_remote_addr zone=conn_limit_per_ip:10m;    limit_req_zone $binary_remote_addr zone=req_limit_per_ip:10m rate=5r/s;    server {        listen 443 ssl http2;# SSL安全配置        ssl_protocols TLSv1.2TLSv1.3;        ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512;        ssl_prefer_server_ciphers off;# 应用限制        limit_conn conn_limit_per_ip 10;        limit_req zone=req_limit_per_ip burst=10 nodelay;}}

系统监控和日志审计:洞察安全态势

1. 系统日志配置

rsyslog安全日志配置

ounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(line# /etc/rsyslog.conf 日志配置# 启用安全相关日志auth,authpriv.*/var/log/auth.logkern.*/var/log/kern.logmail.*/var/log/mail.log# 远程日志发送(可选)*.*@@log-server.company.com:514# 日志轮转配置cat >/etc/logrotate.d/security << EOF/var/log/auth.log {    daily    missingok    rotate 52    compress    delaycompress    notifempty    create 0640 syslog adm}EOF

2. 入侵检测系统部署

AIDE文件完整性监控

ounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(line# 安装和配置AIDEyum install -y aideaide --initmv /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz# 定期完整性检查cat >/etc/cron.daily/aide-check <<'EOF'#!/bin/bashAIDE_REPORT=/tmp/aide_report_$(date +%Y%m%d)aide --check > $AIDE_REPORT 2>&1if[ $?-ne 0];then    mail -s "AIDE检测到系统变化" admin@company.com < $AIDE_REPORTfiEOFchmod +x /etc/cron.daily/aide-check

内核参数调优:系统级安全防护

1. 网络安全参数

系统内核安全参数

ounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(line# /etc/sysctl.conf 安全参数配置# 禁用IP转发net.ipv4.ip_forward =0net.ipv6.conf.all.forwarding =0# 禁用ICMP重定向net.ipv4.conf.all.accept_redirects =0net.ipv6.conf.all.accept_redirects =0net.ipv4.conf.all.send_redirects =0# 启用反向路径过滤net.ipv4.conf.all.rp_filter =1net.ipv4.conf.default.rp_filter =1# 防SYN洪水攻击net.ipv4.tcp_syncookies =1net.ipv4.tcp_max_syn_backlog =2048net.ipv4.tcp_synack_retries =2# 忽略ping请求net.ipv4.icmp_echo_ignore_all =1# 应用配置sysctl -p

2. 内存和进程安全

进程安全控制

ounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(line# 限制core dumpecho "* soft core 0">>/etc/security/limits.confecho "* hard core 0">>/etc/security/limits.conf# 进程数量限制echo "* soft nproc 65536">>/etc/security/limits.confecho "* hard nproc 65536">>/etc/security/limits.conf# 内存随机化echo 2>/proc/sys/kernel/randomize_va_space

自动化安全检查:持续安全保障

1. 综合安全检查脚本

每日安全检查脚本

ounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(line#!/bin/bash# Linux系统安全检查脚本REPORT_FILE="/tmp/security_report_$(date +%Y%m%d).txt"echo "=== Linux系统安全检查报告 ==="$REPORT_FILEecho "检查时间: $(date)">> $REPORT_FILEecho "">> $REPORT_FILE# 检查用户登录echo "=== 近期登录用户 ===">> $REPORT_FILElast-10>> $REPORT_FILE# 检查sudo使用记录echo "=== sudo使用记录 ===">> $REPORT_FILEgrep sudo /var/log/auth.log | tail -10>> $REPORT_FILE# 检查进程状态echo "=== 可疑进程检查 ===">> $REPORT_FILEps aux | awk '{print $1, $2, $11}'| grep -v "^\["sort | uniq -c | sort -nr | head -20>> $REPORT_FILE# 检查网络连接echo "=== 网络连接状态 ===">> $REPORT_FILEnetstat -tupln | grep LISTEN >> $REPORT_FILE# 发送报告mail -s "每日安全检查报告" admin@company.com < $REPORT_FILE

2. 安全基线检查

CIS基准检查脚本

ounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(line#!/bin/bash# CIS基准检查脚本片段check_password_policy(){    echo "检查密码策略..."if grep -q "PASS_MAX_DAYS.*90"/etc/login.defs;then        echo "✓ 密码最大有效期配置正确"else        echo "✗ 密码最大有效期配置异常"fi}check_ssh_config(){    echo "检查SSH配置..."if grep -q "^PermitRootLogin no"/etc/ssh/sshd_config;then        echo "✓ SSH禁止root登录配置正确"else        echo "✗ SSH允许root登录,存在安全风险"fi}# 执行检查check_password_policycheck_ssh_config

应急响应预案:安全事件处理

1. 入侵检测和响应

安全事件响应脚本

ounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(line#!/bin/bash# 安全事件应急响应脚本isolate_system(){    echo "系统隔离中..."# 断开网络(保留SSH管理)    iptables -P INPUT DROP    iptables -P FORWARD DROP    iptables -A INPUT -p tcp --dport 2022-s 192.168.1.100-j ACCEPT    iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT# 停止非必要服务    systemctl stop httpd nginx mysql    echo "系统已隔离,仅保留管理访问"}collect_evidence(){    EVIDENCE_DIR="/tmp/incident_$(date +%Y%m%d_%H%M%S)"    mkdir -p $EVIDENCE_DIR# 收集系统信息    ps aux > $EVIDENCE_DIR/processes.txt    netstat -tupln > $EVIDENCE_DIR/network.txt    lsof > $EVIDENCE_DIR/openfiles.txt# 收集日志    cp /var/log/auth.log $EVIDENCE_DIR/    cp /var/log/messages $EVIDENCE_DIR/    echo "证据收集完成: $EVIDENCE_DIR"}# 使用示例# isolate_system# collect_evidence

安全配置模板:标准化部署

1. 安全加固一键脚本

完整安全加固脚本

ounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(line#!/bin/bash# Linux服务器安全加固一键脚本set-eSCRIPT_NAME="Linux Security Hardening"LOG_FILE="/var/log/security_hardening.log"log(){    echo "[$(date '+%Y-%m-%d %H:%M:%S')$1"tee -a $LOG_FILE}log "开始执行 $SCRIPT_NAME"# 1. 更新系统log "更新系统软件包..."yum update -y >> $LOG_FILE 2>&1# 2. 配置SSHlog "配置SSH安全设置..."cp /etc/ssh/sshd_config /etc/ssh/sshd_config.baksed -i 's/#Port 22/Port 2022/'/etc/ssh/sshd_configsed -i 's/#PermitRootLogin yes/PermitRootLogin no/'/etc/ssh/sshd_configsystemctl restart sshd# 3. 配置防火墙log "配置防火墙规则..."systemctl enable --now firewalldfirewall-cmd --permanent --remove-service=sshfirewall-cmd --permanent --add-port=2022/tcpfirewall-cmd --reloadlog "安全加固完成!请检查日志文件: $LOG_FILE"

持续安全改进:建立安全文化

安全监控仪表板

通过整合各种监控工具,建立全面的安全态势感知:

ounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(lineounter(line# 安全监控数据收集脚本#!/bin/bash# 收集安全指标数据,用于可视化展示METRICS_FILE="/var/log/security_metrics.json"{    echo "{"    echo "  \"timestamp\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\","    echo "  \"failed_logins\": $(grep "Failed password" /var/log/auth.log | wc -l),"    echo "  \"active_connections\": $(netstat -tn | grep :22 | wc -l),"    echo "  \"suspicious_processes\": $(ps aux | grep -E "(nc|wget|curl)" | wc -l),"    echo "  \"disk_usage\": $(df / | awk 'NR==2 {print $5}' | sed 's/%//'),"    echo "  \"load_average\": \"$(uptime | awk -F'load average:' '{print $2}')\""    echo "}"}> $METRICS_FILE

安全培训和意识提升

建立定期的安全培训机制:

新员工安全意识培训定期安全演练和测试安全事件经验分享会最新威胁情报学习

总结:构建多层次安全防护体系

Linux系统安全加固是一个持续的过程,需要我们从多个维度建立防护体系:

核心安全原则

1.最小权限原则:只给必要的权限,定期审查权限分配2.深度防护:多层次防护,单点失效不影响整体安全3.持续监控:实时监控系统状态,快速发现异常4.定期更新:及时应用安全补丁,更新安全配置

实施路线图

第一阶段:基础加固(1-2周)

用户和权限管理SSH安全配置  防火墙基础规则关键服务加固

第二阶段:监控完善(2-3周)

日志配置和监控入侵检测系统自动化检查脚本安全基线检查

第三阶段:持续改进(长期)

安全培训和演练威胁情报整合应急响应优化安全工具升级

成功经验分享

在我的实际工作中,通过系统性的安全加固措施:

减少了95%的暴力破解攻击成功率将安全事件响应时间从小时级缩短到分钟级建立了完善的安全监控体系,实现7×24小时安全态势感知

记住,安全永远不是一蹴而就的,需要我们持续关注、不断改进。在这个信息安全威胁日益严峻的时代,掌握这些实用的安全加固技巧,不仅能保护企业的数字资产,更能提升你作为运维工程师的核心竞争力。


安全无小事,防范于未然。如果这篇文章对你有帮助,请点赞收藏并分享给更多需要的小伙伴!

关注我,获取更多运维干货:

系统安全防护实战自动化运维工具分享  故障排查经验总结最新技术趋势解析

让我们一起在运维安全的道路上精进技艺,守护数字世界的安全!

WeChat group

为了方便大家更好的交流运维等相关技术问题,创建了微信交流群,需要加群的小伙伴们可以扫一扫下面的二维码加我为好友拉您进群(备注:加群)。

代码仓库网址
Githubhttps://github.com/raymond999999
Giteehttps://gitee.com/raymond9

Blog

博客网址
CSDN
https://blog.csdn.net/qq_25599925
稀土掘金https://juejin.cn/user/4262187909781751
知识星球https://wx.zsxq.com/group/15555885545422
阿里云社区https://developer.aliyun.com/profile/snzh3xpxaf6sg
腾讯云社区https://cloud.tencent.com/developer/user/11823619
华为云社区https://developer.huaweicloud.com/usercenter/mycommunity/dynamics

访问博客网站,查看更多优质原创内容。

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-02-07 23:25:45 HTTP/2.0 GET : https://f.mffb.com.cn/a/473173.html
  2. 运行时间 : 0.127421s [ 吞吐率:7.85req/s ] 内存消耗:4,400.46kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=561940a8c548d18ef4899913f56b2ac0
  1. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/runtime/temp/067d451b9a0c665040f3f1bdd3293d68.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000624s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000867s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.003809s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000285s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000591s ]
  6. SELECT * FROM `set` [ RunTime:0.001515s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000596s ]
  8. SELECT * FROM `article` WHERE `id` = 473173 LIMIT 1 [ RunTime:0.001921s ]
  9. UPDATE `article` SET `lasttime` = 1770477945 WHERE `id` = 473173 [ RunTime:0.013847s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 67 LIMIT 1 [ RunTime:0.001169s ]
  11. SELECT * FROM `article` WHERE `id` < 473173 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.011654s ]
  12. SELECT * FROM `article` WHERE `id` > 473173 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.003180s ]
  13. SELECT * FROM `article` WHERE `id` < 473173 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.003965s ]
  14. SELECT * FROM `article` WHERE `id` < 473173 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.004163s ]
  15. SELECT * FROM `article` WHERE `id` < 473173 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.010510s ]
0.129039s