# Discourse перегружен реальным трафиком или DDoS? 100% загрузка ЦП при адекватном трафике и мощном сервере

**URL:** https://meta.discourse.org/t/discourse-overloaded-real-traffic-or-ddos-100-cpu-usage-despite-of-decent-traffic-and-high-specs-server/203976
**Category:** Self-hosting
**Tags:** server-resources
**Created:** [19.Сентябрь.2021 21:33:10 UTC](https://meta.discourse.org/t/discourse-overloaded-real-traffic-or-ddos-100-cpu-usage-despite-of-decent-traffic-and-high-specs-server/203976 "2021-09-19T21:33:10Z")
**Posts on this page:** 1
**Showing post:** 19

<div class="post-metadata">

### Author: ![lucasbasquerotto](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lucasbasquerotto/32/133376_2.png) [@lucasbasquerotto](https://meta.discourse.org/u/lucasbasquerotto)
#### Post date: [24.Сентябрь.2021 18:10:32 UTC](https://meta.discourse.org/t/discourse-overloaded-real-traffic-or-ddos-100-cpu-usage-despite-of-decent-traffic-and-high-specs-server/203976/19 "2021-09-24T18:10:32Z")

</div>

IP-адрес `172.17.0.1`, вероятно, является Docker-адресом. Я предполагаю, что логи, которые вы опубликовали, относятся к сервису nginx в контейнере Discourse. Скорее всего, nginx на вашем хосте пересылает запросы в nginx внутри контейнера Discourse, и именно этот nginx видит IP-адрес от nginx на вашем хосте.

Вы можете исправить это, либо установив в Discourse значение заголовка, отправляемого nginx на хосте, как реальный IP, либо используя сокет для соединения сервисов nginx.

Например, в конфигурации nginx на хосте вы можете добавить `proxy_set_header X-Real-IP $remote_addr;`, а в конфигурации nginx внутри контейнера Discourse использовать реальный IP на основе этого заголовка: `set_real_ip_from 0.0.0.0/0;` (при условии, что к nginx в Discourse нет прямого публичного доступа) и `real_ip_header X-Real-IP;`. Возможно, вам потребуется использовать шаблон или выполнить команду `sed`, чтобы внести эти изменения в конфигурационный файл nginx в Discourse.

Другой вариант — использование сокетов и включение файла `web.socketed.template.yml` в соответствии с инструкциями по ссылке:

> [@Run other websites on the same machine as Discourse](https://meta.discourse.org/t/running-other-websites-on-the-same-machine-as-discourse/17247):
>
> @pfaffman edited this heavily 2022.02.24. Blame me if it’s broken. If you want to run other websites on the same machine as Discourse, you need to set up an extra NGINX or HAProxy proxy in front of the Docker container. NOTE: This is for advanced admins This guide assumes you already have Discourse working - if you don’t, it may be hard to tell whether or not the configuration is working. You cannot use ./discourse-setup to set up Discourse if another server is using port 80 or 443. You will…

Однако, если это возможно, я рекомендую использовать Discourse на отдельном сервере, без необходимости использовать nginx в качестве обратного прокси-сервера. Это сделает настройку гораздо более простой и понятной.

---

_[View the full topic](https://meta.discourse.org/t/discourse-overloaded-real-traffic-or-ddos-100-cpu-usage-despite-of-decent-traffic-and-high-specs-server/203976)._
