fix(nginx): 配置文件使用.conf后缀以匹配nginx include规则
nginx.conf 使用 include /etc/nginx/sites-enabled/*.conf 因此配置文件必须以 .conf 结尾才能被加载。 变更: - 添加 DOMAIN_CONF 变量 (mpc-grpc.szaiai.com.conf) - 更新所有文件路径使用 .conf 后缀 - 卸载时兼容新旧文件名 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
e268c33fa9
commit
2a11392ce2
|
|
@ -17,6 +17,7 @@
|
|||
set -e
|
||||
|
||||
DOMAIN="mpc-grpc.szaiai.com"
|
||||
DOMAIN_CONF="${DOMAIN}.conf" # Nginx 配置文件需要 .conf 后缀
|
||||
EMAIL="admin@szaiai.com"
|
||||
BACKEND_HOST="192.168.1.111"
|
||||
BACKEND_PORT="50051"
|
||||
|
|
@ -73,8 +74,8 @@ configure_http() {
|
|||
mkdir -p /var/www/certbot/.well-known/acme-challenge
|
||||
chmod -R 755 /var/www/certbot
|
||||
|
||||
# 创建临时 HTTP 配置
|
||||
cat > /etc/nginx/sites-available/$DOMAIN << EOF
|
||||
# 创建临时 HTTP 配置 (使用 .conf 后缀以便 nginx 加载)
|
||||
cat > /etc/nginx/sites-available/$DOMAIN_CONF << EOF
|
||||
# 临时 HTTP 配置 - 用于 Let's Encrypt 验证
|
||||
server {
|
||||
listen 80;
|
||||
|
|
@ -94,7 +95,7 @@ server {
|
|||
EOF
|
||||
|
||||
# 启用站点
|
||||
ln -sf /etc/nginx/sites-available/$DOMAIN /etc/nginx/sites-enabled/
|
||||
ln -sf /etc/nginx/sites-available/$DOMAIN_CONF /etc/nginx/sites-enabled/$DOMAIN_CONF
|
||||
|
||||
# 测试并重载
|
||||
nginx -t && systemctl reload nginx
|
||||
|
|
@ -131,7 +132,7 @@ configure_grpc() {
|
|||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# 复制 gRPC 配置
|
||||
cp "$SCRIPT_DIR/mpc-grpc.szaiai.com.conf" /etc/nginx/sites-available/$DOMAIN
|
||||
cp "$SCRIPT_DIR/mpc-grpc.szaiai.com.conf" /etc/nginx/sites-available/$DOMAIN_CONF
|
||||
|
||||
# 测试并重载
|
||||
nginx -t && systemctl reload nginx
|
||||
|
|
@ -214,7 +215,9 @@ show_help() {
|
|||
uninstall() {
|
||||
log_info "卸载 MPC gRPC 代理配置..."
|
||||
|
||||
# 移除站点配置
|
||||
# 移除站点配置 (兼容新旧文件名)
|
||||
rm -f /etc/nginx/sites-enabled/$DOMAIN_CONF
|
||||
rm -f /etc/nginx/sites-available/$DOMAIN_CONF
|
||||
rm -f /etc/nginx/sites-enabled/$DOMAIN
|
||||
rm -f /etc/nginx/sites-available/$DOMAIN
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue