Files
common-server-public/nginx/updateConfig.sh
2025-03-03 17:43:50 +08:00

15 lines
345 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
# 备份并覆盖配置文件
cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
cp nginx.conf /etc/nginx/
# 测试并重载配置
if nginx -t; then
systemctl reload nginx
echo "配置已生效HTTPS已启用"
else
echo "配置测试失败,已恢复备份"
cp /etc/nginx/nginx.conf.bak /etc/nginx/nginx.conf
fi