#!/bin/bash if [ "$EUID" -ne 0 ]; then echo "错误: 本脚本必须以 root 权限运行。" echo "请使用 'sudo ./脚本名.sh' 或切换到 root 用户后运行。" exit 1 fi export PATH=$PATH:/usr/sbin:/usr/local/openresty/bin INSTALL_PREFIX="/usr/local/openresty" NGINX_CONF_DIR="${INSTALL_PREFIX}/nginx/conf" CONFD_DIR="${NGINX_CONF_DIR}/conf.d" set -e /usr/local/bin/proxy-update service xray restart echo "=== [5/8] 写入 Nginx 配置文件 ===" # 5.1 写入 nginx.conf cat > "${NGINX_CONF_DIR}/nginx.conf" < "${NGINX_CONF_DIR}/stream.conf" < "${CONFD_DIR}/default.conf" < "${CONFD_DIR}/fallback.conf" <