# Настройка Firewall

{% hint style="warning" %}
Важно: Действия нужно производить под пользователем **root**
{% endhint %}

1. Подключитесь к своему серверу по SSH
2. Устанавливаем **ufw** c помощью пакетного менеджера:

   ```bash
   apt install ufw
   ```

   UFW - утилита для конфигурирования межсетевого экрана нужна для упрощенной настройки правил доступов к сети сервера
3. Добавляем свой IP для доступа к серверу по SSH (по умолчанию порт SSH 22)\
   открываем 22 порт для доступа по SSH если у вас другой порт замените число 22 на ваше значение:

   ```bash
   ufw allow from any to any port 22
   ```

   **или** если у вас есть статичный IP-адрес то лучше ограничьте доступ SSH по вашему IP [см. инструкцию ](/dlya-razrabotchikov/nastroika-firewall/nastroika-dostupa-porta-22-ssh.md)
4. Разрешаем http/s 80,443 порт [см. инструкцию](/dlya-razrabotchikov/nastroika-firewall/nastroika-dostupa-portov-80-443-http-s.md)
5. Включаем UFW&#x20;

   ```bash
   ufw enable
   ```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://manual.boxexchanger.net/dlya-razrabotchikov/nastroika-firewall.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
