Fix Caddy config port

This commit is contained in:
Whispering Wind
2025-02-13 00:29:03 +03:30
committed by GitHub
parent 9f40dec9e6
commit 66fd6bf1d2

View File

@ -63,6 +63,24 @@ for FILE in "${FILES[@]}"; do
cp "$TEMP_DIR/$FILE" "$FILE" cp "$TEMP_DIR/$FILE" "$FILE"
done done
CADDYFILE="/etc/hysteria/core/scripts/webpanel/Caddyfile"
if [ -f "$CADDYFILE" ]; then
echo "Updating Caddyfile port from 8080 to 28260"
sed -i 's/\(:[[:space:]]*\)8080/\128260/g' "$CADDYFILE"
sed -i 's/0\.0\.0\.0:8080/0.0.0.0:28260/g' "$CADDYFILE"
sed -i 's/127\.0\.0\.1:8080/127.0.0.1:28260/g' "$CADDYFILE"
if ! grep -q ':28260' "$CADDYFILE"; then
echo "Warning: Caddyfile does not contain port 8080 in expected formats. Port replacement may have already been done."
fi
else
echo "Error: Caddyfile not found at $CADDYFILE. Cannot update port."
fi
CONFIG_ENV="/etc/hysteria/.configs.env" CONFIG_ENV="/etc/hysteria/.configs.env"
if [ ! -f "$CONFIG_ENV" ]; then if [ ! -f "$CONFIG_ENV" ]; then
echo ".configs.env not found, creating it with default values." echo ".configs.env not found, creating it with default values."
@ -98,13 +116,16 @@ python3 -m venv hysteria2_venv
source /etc/hysteria/hysteria2_venv/bin/activate source /etc/hysteria/hysteria2_venv/bin/activate
pip install -r requirements.txt pip install -r requirements.txt
echo "Restarting hysteria services" echo "Restarting hysteria-caddy service"
systemctl restart hysteria-caddy.service
echo "Restarting other hysteria services"
systemctl restart hysteria-server.service systemctl restart hysteria-server.service
systemctl restart hysteria-telegram-bot.service systemctl restart hysteria-telegram-bot.service
systemctl restart hysteria-singbox.service systemctl restart hysteria-singbox.service
systemctl restart hysteria-normal-sub.service systemctl restart hysteria-normal-sub.service
systemctl restart hysteria-webpanel.service systemctl restart hysteria-webpanel.service
systemctl restart hysteria-caddy.service
echo "Checking hysteria-server.service status" echo "Checking hysteria-server.service status"
if systemctl is-active --quiet hysteria-server.service; then if systemctl is-active --quiet hysteria-server.service; then