> For the complete documentation index, see [llms.txt](https://docs.iexexchanger.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.iexexchanger.com/guide/sait/faily-podtverzhdenii/nastroika-nginx-dlya-failov-podtverzhdenii.md).

# Настройка Nginx для файлов подтверждений

Чтобы файлы подтверждений открывались из корня основного сайта, необходимо добавить отдельное правило в конфигурацию Nginx для frontend-домена.

Файлы загружаются через админку и сохраняются на стороне backend-проекта, но открываться должны по адресу основного сайта:

```
https://ваш-домен/trst.txt
https://ваш-домен/google123.html
https://ваш-домен/yandex_abc.xml
```

***

## Откройте конфигурацию Nginx

{% content-ref url="/spaces/SZ7jPUG5OOOS4hofY7a2/pages/E9WKesM7XwCwE0IsKTAh" %}
[Настройка Nginx](/ustanovka-i-obnovlenie/ustanovka/nastroika-fastpanel/nastroika-nginx.md)
{% endcontent-ref %}

В FastPanel откройте сайт основного frontend-домена и перейдите в настройки Nginx.

Найдите блок `server` для основного сайта и добавьте правило ниже выше основного Angular/SSR fallback.

***

#### Добавьте правило

```nginx
location ~* "^/(?!(?:3rdpartylicenses\.txt|favicon\.ico|hot|index\.php|ngsw\.json|project_info\.txt|robots\.txt|sitemap\.xml|valuta\.xml|web\.config)$)([A-Za-z0-9][A-Za-z0-9._-]{0,127}\.(?:txt|html|htm|xml|json))$" {
    alias /var/www/имя_пользователя_backend/data/www/backend_домен/public/site-verification-files/$1;

    types {
        text/plain txt;
        text/html html htm;
        application/xml xml;
        application/json json;
    }

    default_type text/plain;
    access_log off;
}
```

Замените:

```
имя_пользователя_backend
```

на пользователя backend-сайта.

Замените:

```
backend_домен
```

на домен backend-проекта, например:

```
app.example.com
```

***

#### Проверьте конфигурацию

После сохранения выполните проверку Nginx:

```bash
nginx -t
```

Если ошибок нет, перезагрузите Nginx:

```bash
systemctl reload nginx
```

***

#### Проверьте файл

Загрузите файл через раздел:

«Утилиты» — «Файлы подтверждений»

После загрузки откройте файл в браузере:

```
https://ваш-домен/имя-файла.txt
```

Или проверьте через терминал:

```bash
curl -i https://ваш-домен/имя-файла.txt
```

Если всё настроено правильно, файл откроется напрямую, без перехода в Angular/SSR-страницу сайта.

***

#### Если открывается сайт вместо файла

Проверьте:

* правило добавлено именно в конфиг frontend-домена;
* правило стоит выше Angular/SSR fallback;
* путь в `alias` ведёт к backend-папке `public/site-verification-files`;
* Nginx был перезагружен после изменения;
* файл загружен через админку;
* расширение файла поддерживается: `txt`, `html`, `htm`, `xml`, `json`.

***

#### Если файл не найден

Проверьте, что файл есть на сервере:

```bash
ls -la /var/www/имя_пользователя_backend/data/www/backend_домен/public/site-verification-files/
```

Также убедитесь, что Nginx имеет доступ на чтение этой папки.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.iexexchanger.com/guide/sait/faily-podtverzhdenii/nastroika-nginx-dlya-failov-podtverzhdenii.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
