1
0
mirror of https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git synced 2025-08-14 00:25:46 +02:00

починка уведомлени в тг22

This commit is contained in:
MoonTestUse1
2025-01-04 05:20:56 +06:00
parent 4634262b91
commit cb9a10e36c
9 changed files with 285 additions and 48 deletions

View File

@@ -0,0 +1,53 @@
#!/bin/sh
# Домены для SSL-сертификата
domains="itformhelp.ru www.itformhelp.ru"
email="admin@itformhelp.ru"
# Функция для получения сертификата
get_certificate() {
echo "Requesting Let's Encrypt certificate for $domains ..."
# Создаем временный конфиг nginx для валидации certbot
cat > /etc/nginx/conf.d/temp.conf << EOF
server {
listen 80;
server_name $domains;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 301 https://\$host\$request_uri;
}
}
EOF
# Перезапускаем nginx с временным конфигом
nginx -t && nginx -s reload
# Запрашиваем сертификат
certbot certonly --webroot \
--webroot-path=/var/www/certbot \
--email $email \
--agree-tos \
--no-eff-email \
--force-renewal \
-d $(echo $domains | sed 's/ / -d /g')
# Удаляем временный конфиг
rm /etc/nginx/conf.d/temp.conf
}
# Проверяем наличие сертификата
if [ ! -d "/etc/letsencrypt/live/itformhelp.ru" ]; then
get_certificate
fi
# Запускаем фоновый процесс для автоматического обновления сертификатов
while :; do
certbot renew --deploy-hook "nginx -s reload"
sleep 12h
done &
# Запускаем nginx
nginx -g "daemon off;"