Files
OBS/2. Проекты/Adguard/4. Получение SSL-сертификатов.md

40 lines
980 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Сначала настроим "заглушку" в Nginx, чтобы Certbot мог подтвердить домен.
**Настраиваем default конфиг Nginx:**
```
nano /etc/nginx/sites-available/default
```
**Вставляем код:**
```
server {
listen 80 default_server;
server_name _;
# Разрешаем Certbot'у проверять домены
location ^~ /.well-known/acme-challenge/ {
default_type "text/plain";
root /var/www/html;
}
# Все остальные запросы отбрасываем
location / {
return 404;
}
}
```
_Сохранить и выйти._
**Перезапускаем Nginx:**
```
sudo systemctl reload nginx
```
**Получаем сертификат:** Указать свой домен!
```
sudo certbot certonly --webroot -w /var/www/html -d adguard.example.com
```
>[!Bug] Переход в [[5. Настройка Nginx как Прокси]]