Files
common-server-public/nginx/updateConfig.sh
awei 4e51db4edd v2
2025-03-08 17:21:51 +08:00

18 lines
472 B
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/bash
# 备份并覆盖所有.conf配置文件
for conf in *.conf; do
cp "/etc/nginx/$conf" "/etc/nginx/${conf}.bak" 2>/dev/null || true
cp "$conf" /etc/nginx/
done
# 测试并重载配置
if nginx -t; then
systemctl reload nginx
echo "配置已生效HTTPS已启用"
else
echo "配置测试失败,正在恢复所有备份"
for conf in *.conf; do
mv -f "/etc/nginx/${conf}.bak" "/etc/nginx/$conf" 2>/dev/null || true
done
fi