Discuz!小编 发表于 2026-8-15 18:35:58

新人帖 云服务器负载堵塞,8核心CPU100%,求个大神帮忙解决一下

本人论坛换服务器后,老是负载堵塞,CPU100%,网上查说是爬虫太多,还有就是CC攻击,8核的服务器卡得动不了,我自己水平有限,付费求个大神帮忙解决哈,顺便升级下5.0。看下有没有大神帮忙一下!谢谢。



联系QQ:3416807272,微信:19105973888


我知道答案 回答被采纳将会获得1 贡献 已有7人回答

海军大都督 发表于 2026-8-15 18:36:33

            
            
      
   

                        这是图片,刚忘传了
       

.ce-block {    margin-bottom: 20px;}.ce-block__content,.ce-toolbar__content {        /* max-width:calc(100% - 50px) */        margin-left: auto;    margin-right: auto;}.image-tool {--bg-color: #cdd1e0;--front-color: #388ae5;--border-color: #e8e8eb;}.image-tool__image {    border-radius: 3px;    overflow: hidden;    margin-bottom: 10px;}.image-tool__image-picture {      max-width: 100%;      vertical-align: bottom;      display: block;      margin-left: auto;      margin-right: auto;    }.image-tool__image-preloader {      width: 50px;      height: 50px;      border-radius: 50%;      background-size: cover;      margin: auto;      position: relative;      background-color: #cdd1e0;      background-position: center center;    }.image-tool__image-preloader::after {      content: "";      position: absolute;      z-index: 3;      width: 60px;      height: 60px;      border-radius: 50%;      border: 2px solid #cdd1e0;      border-top-color: #388ae5;      left: 50%;      top: 50%;      margin-top: -30px;      margin-left: -30px;      animation: image-preloader-spin 2s infinite linear;      box-sizing: border-box;      }.image-tool__caption::before {      position: absolute !important;      content: attr(data-placeholder);      color: #707684;      font-weight: normal;      display: none;    }.image-tool__caption:empty::before {      display: block;      }.image-tool__caption:empty:focus::before {      display: none;      }.image-tool--empty .image-tool__image {      display: none;    }.image-tool--empty .image-tool__caption, .image-tool--loading .image-tool__caption {      display: none;    }.image-tool .cdx-button {    display: flex;    align-items: center;    justify-content: center;}.image-tool .cdx-button svg {      height: auto;      margin: 0 6px 0 0;    }.image-tool--filled .cdx-button {      display: none;    }.image-tool--filled .image-tool__image-preloader {      display: none;      }.image-tool--loading .image-tool__image {      min-height: 200px;      display: flex;      border: 1px solid #e8e8eb;      background-color: #fff;    }.image-tool--loading .image-tool__image-picture {      display: none;      }.image-tool--loading .cdx-button {      display: none;    }/**   * Tunes   * ----------------   */.image-tool--withBorder .image-tool__image {      border: 1px solid #e8e8eb;    }.image-tool--withBackground .image-tool__image {      padding: 15px;      background: #cdd1e0;    }.image-tool--withBackground .image-tool__image-picture {      max-width: 60%;      margin: 0 auto;      }.image-tool--stretched .image-tool__image-picture {      width: 100%;      }.image-tool__caption {                text-align: center;                font-size: 14px;                color: #a3a3a3;        }@keyframes image-preloader-spin {0% {    transform: rotate(0deg);}100% {    transform: rotate(360deg);}}.ce-block {    margin-bottom: 20px;}.ce-block__content,.ce-toolbar__content {        /* max-width:calc(100% - 50px) */        margin-left: auto;    margin-right: auto;}.ce-paragraph {    line-height: 1.6em;    outline: none;    text-indent: 2em;    font-size: 16px;}.ce-paragraph--right {    text-align: right;}.ce-paragraph--center {    text-align: center;}.ce-paragraph--left {    text-align: left;}.ce-paragraph--justify {    text-align: justify;}.ce-paragraph-text-indent {    text-align: justify;}.ce-paragraph:empty::before{content: attr(data-placeholder);color: #707684;font-weight: normal;opacity: 0;}/** Show placeholder at the first paragraph if Editor is empty */.codex-editor--empty .ce-block:first-child .ce-paragraph:empty::before {opacity: 1;}.codex-editor--toolbox-opened .ce-block:first-child .ce-paragraph:empty::before,.codex-editor--empty .ce-block:first-child .ce-paragraph:empty:focus::before {opacity: 0;}.ce-paragraph p:first-of-type{    margin-top: 0;}.ce-paragraph p:last-of-type{    margin-bottom: 0;}.svg-icon {    width: 1em;    height: 1em;}.svg-icon path,.svg-icon polygon,.svg-icon rect {    fill: #4691f6;}.svg-icon circle {    stroke: #4691f6;    stroke-width: 1;}.inline-code {background: rgba(250, 239, 240, 0.78);color: #b44437;padding: 3px 4px;border-radius: 5px;margin: 0 1px;font-family: inherit;font-size: 0.86em;font-weight: 500;letter-spacing: 0.3px;}

凡若尘 发表于 2026-8-15 18:37:30

面对CPU被占满、网站卡得动不了的紧急情况,别慌。这通常就是两种可能:要么是被CC攻击了,要么是搜索引擎爬虫抓取太猛。按照下面几步走,能最快让网站缓过来。

⚡️ 紧急抢救:5分钟内让网站喘口气


[*] 开启Discuz!自带的"强力防护":这是最快、最直接的办法。在论坛的 config/config_global.php 文件里,找到这行代码:        $_config['security']['attackevasive'] = 0;
把它修改为 4(代表开启"二次请求"模式),或者更猛一点,组合成 1|4 或 1|2|4|8。
注意:这个功能可能会误伤正常的搜索引擎爬虫,影响收录。但现在是保命要紧,先开了再说,等服器稳定了再回来调整。
[*] 在后台或宝塔面板开启"增强模式":
如果你用了宝塔面板,立刻在Nginx防火墙/WAF里,把CC防御规则调整为"增强模式"。这个模式下,拦截会更果断,能快速挡掉大部分攻击流量。
[*] 如果你没用宝塔,可以登录Discuz!后台,在全局 → 安全设置 → CC防护设置里,把规则临时收紧。参考配置:60秒内,超过50次访问,就封锁3600秒。虽然严格,但能迅速切断攻击源。


🔍 快速定位:到底是谁在捣乱?

在采取急救措施的同时,可以快速排查一下,这也有助于判断是不是真被攻击了。

用 htop 看看是哪个进程在"吃"CPU:登录服器,运行 htop 命令(如果没装,先运行 yum install -y htop 或 apt install -y htop)。按 F6,选 PERCENT_CPU 排序,看看是 php-fpm、mysqld 还是 nginx 占得最多。 查看网站访问日志:在宝塔面板或服器上查看最近的网站访问日志。如果你看到大量来自同一个IP或IP段的请求,而且请求的URL非常规(比如一堆乱码参数),那基本就是被CC攻击了。

🛡️ 接下来怎么办?标本兼治的几件事

等服器暂时稳定下来,建议做这几件事,避免再次陷入困境:

给搜索引擎"开个后门":在Discuz!后台的CC防护设置里,找到"白名单IP",把主流搜索引擎的IP段加进去。常用的百度爬虫IP段有 123.125..、220.181.. 等。这样既不影响收录,下次也不用担心误伤爬虫。
[*] 设置更精确的访问频率:可以参考下面这个配置,根据你论坛的访问量来设置:
中小型论坛:建议 60秒内访问300次,封锁300秒(5分钟),这个设置能在防护和用户体验间取得不错的平衡。
[*] 大型论坛:可以收紧到 60秒内访问80-100次,封锁1800秒(30分钟),对高频攻击的威慑力更强。
考虑套个"盾牌"(CDN):长远来看,最省心的方法是给网站加上CDN(如阿里云、腾讯云的CDN或WAF服务)。CDN不仅能加速访问,还能在攻击到达你的服器之前就进行清洗和拦截,隐藏你服器的真实IP,这是最有效的防御手段之一。


不懂就接着聊:https://chat.deepseek.com/share/t2doyazllu07b3ioc7

参考:感谢雷池WAF,帮我扛住一天百万攻击! - 站长杂谈 - Powered by Discuz!
https://www.dismall.com/thread-29030-1-1.html

Jessie 发表于 2026-8-15 18:38:12

面版的 防火墙启用下 开启cc防护后 看看访问日志 封禁下ip

凡若尘 发表于 2026-8-15 18:39:05

需要检查日志,大概是对方网站搞的CC攻击,看起来是爬虫,但是更多的可能 是低频攻击,可以接入我的CC防护系统 ,立杆见影。

KarlMock59 发表于 2026-8-15 18:39:39

我的网站 前几天也遭遇了大规模cc, 带宽 使用能飚到二三十M,

经过ip拦截+恶意蜘蛛拦截+限流 后顺利解决

海军大都督 发表于 2026-8-15 18:40:36

丢个QQ和微信就走的,不值理。

瑾瑜 发表于 2026-8-15 18:41:22

别着急开启这个开启那个,又修改这个修改那个的;先看一下哪个进程占满的
页: [1]
查看完整版本: 新人帖 云服务器负载堵塞,8核心CPU100%,求个大神帮忙解决一下