1
0
mirror of https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git synced 2025-08-14 00:25:46 +02:00
Files
AdministrationItDepartmens/docker/frontend/init-ssl.sh
2025-01-03 00:26:36 +06:00

34 lines
1.1 KiB
Bash
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.

#!/bin/sh
# Проверяем наличие сертификата
if [ ! -f "/etc/letsencrypt/live/itformhelp.ru/fullchain.pem" ]; then
echo "Сертификат не найден. Получаем новый..."
# Останавливаем nginx для освобождения 80 порта
nginx -s stop || true
# Ждем освобождения порта
sleep 5
# Получаем сертификат
certbot certonly --standalone \
--email crocoman7887@gmail.com \
--agree-tos \
--no-eff-email \
--non-interactive \
-d itformhelp.ru
# Проверяем успешность получения сертификата
if [ ! -f "/etc/letsencrypt/live/itformhelp.ru/fullchain.pem" ]; then
echo "Ошибка получения сертификата"
exit 1
fi
echo "Сертификат успешно получен"
else
echo "Сертификат уже существует"
fi
# Запускаем nginx с новой конфигурацией
echo "Запускаем nginx..."
nginx -g "daemon off;"