From 94ea0bbda171fe863cfee40c2005876fe6c33fd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B8=D0=BA=D1=82=D0=BE=D1=80?= Date: Mon, 18 May 2026 06:43:25 +0900 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D1=83=D1=81=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D0=BA?= =?UTF-8?q?=D1=83=20=D0=BF=D0=B0=D0=BD=D0=B5=D0=BB=D0=B8=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B8=20=D0=B7=D0=B0=D0=BD=D1=8F=D1=82=D0=BE=D0=BC=20=D0=BF?= =?UTF-8?q?=D0=BE=D1=80=D1=82=D0=B5=2080?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/config.example.php | 1 + deploy/apache/xlx-panel.conf | 2 +- docs/INSTALL_SYSTEM.md | 6 ++++++ scripts/install-system.sh | 41 +++++++++++++++++++++++++++++++++--- 4 files changed, 46 insertions(+), 4 deletions(-) diff --git a/config/config.example.php b/config/config.example.php index 5f7fbb7..afeb2cf 100644 --- a/config/config.example.php +++ b/config/config.example.php @@ -14,6 +14,7 @@ return [ 'debug' => (bool) (getenv('XLX_DEBUG') ?: false), 'base_url' => $baseUrl, 'timezone' => getenv('XLX_TIMEZONE') ?: 'Europe/Moscow', + 'panel_port' => (int) (getenv('XLX_PANEL_PORT') ?: 80), ], 'database' => [ diff --git a/deploy/apache/xlx-panel.conf b/deploy/apache/xlx-panel.conf index d6e007c..5b00974 100644 --- a/deploy/apache/xlx-panel.conf +++ b/deploy/apache/xlx-panel.conf @@ -1,4 +1,4 @@ - + ServerName _ DocumentRoot __PUBLIC_DIR__ diff --git a/docs/INSTALL_SYSTEM.md b/docs/INSTALL_SYSTEM.md index 4696774..b75d54d 100644 --- a/docs/INSTALL_SYSTEM.md +++ b/docs/INSTALL_SYSTEM.md @@ -28,6 +28,12 @@ sudo bash scripts/install-system.sh 3. первый IP из `hostname -I`; 4. `127.0.0.1` как последний fallback. +Если порт `80` уже занят другим сервисом, панель автоматически будет поставлена на `8088`. Порт можно задать вручную: + +```bash +sudo XLX_PANEL_PORT=8090 bash scripts/install-system.sh +``` + В конце он покажет: - URL сайта; diff --git a/scripts/install-system.sh b/scripts/install-system.sh index aecc464..b4001bf 100644 --- a/scripts/install-system.sh +++ b/scripts/install-system.sh @@ -32,6 +32,27 @@ detect_host() { echo "127.0.0.1" } +port_is_busy() { + local port="$1" + ss -ltnH "sport = :${port}" 2>/dev/null | grep -q . +} + +detect_panel_port() { + if [[ -n "${XLX_PANEL_PORT:-}" ]]; then + echo "$XLX_PANEL_PORT" + return + fi + + for port in 80 8088 8090 8091; do + if ! port_is_busy "$port"; then + echo "$port" + return + fi + done + + echo "8099" +} + random_token() { local token token="$(tr -dc 'A-Za-z0-9' /etc/apache2/sites-available/xlx-panel.conf +cat > /etc/apache2/ports.conf < /etc/apache2/sites-available/xlx-panel.conf a2dissite 000-default.conf >/dev/null 2>&1 || true a2ensite xlx-panel.conf -systemctl reload apache2 +systemctl restart apache2 bash "$REPO_ROOT/scripts/install-xlxd.sh" systemctl start xlxd || true