From 2fbcd0c50d4e6425d441fd7eece1da484a6036da Mon Sep 17 00:00:00 2001 From: Hank Date: Wed, 17 Jun 2026 23:33:36 +0800 Subject: [PATCH] =?UTF-8?q?fix(vps):=20=E5=8A=A0=20TrustProxies=E3=80=81Re?= =?UTF-8?q?dis=20=E6=8C=81=E4=B9=85=E5=8C=96=20Volume=E3=80=81Log=20?= =?UTF-8?q?=E6=94=B9=20daily?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - bootstrap/app.php: trustProxies(at: ['*']) 讓 NPM 反向代理的 X-Forwarded-* header 被信任 - docker-compose.yml: Redis 加 redis-data volume,重啟後 session/queue/cache 不再清空 - .env.example: LOG_STACK 改 daily + LOG_DAILY_DAYS=14,避免 VPS 磁碟被單一 log 吃滿 Co-Authored-By: Claude Sonnet 4.6 --- .env.example | 3 ++- bootstrap/app.php | 1 + docker-compose.yml | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index ca77aa0..8489a48 100644 --- a/.env.example +++ b/.env.example @@ -16,7 +16,8 @@ APP_MAINTENANCE_STORE=database BCRYPT_ROUNDS=12 LOG_CHANNEL=stack -LOG_STACK=single +LOG_STACK=daily +LOG_DAILY_DAYS=14 LOG_DEPRECATIONS_CHANNEL=null LOG_LEVEL=debug diff --git a/bootstrap/app.php b/bootstrap/app.php index 79db09d..00ffe4f 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -13,6 +13,7 @@ return Application::configure(basePath: dirname(__DIR__)) health: '/up', ) ->withMiddleware(function (Middleware $middleware) { + $middleware->trustProxies(at: ['*']); $middleware->alias([ 'admin' => \App\Http\Middleware\EnsureAdmin::class, ]); diff --git a/docker-compose.yml b/docker-compose.yml index dc877de..b38ad9b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -159,6 +159,8 @@ services: restart: unless-stopped networks: - cfdive-network + volumes: + - redis-data:/data healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 30s @@ -205,3 +207,5 @@ networks: volumes: mysql-data: driver: local + redis-data: + driver: local