From 6f5d68eefd5f44bbdc13c8e891961368cf9ec9a1 Mon Sep 17 00:00:00 2001 From: Xika Date: Wed, 10 Jun 2026 19:04:40 +0000 Subject: [PATCH] =?UTF-8?q?fix(nginx):=20add=20^~=20/assets/=20alias=20to?= =?UTF-8?q?=20serve=20Views/assets/=20=E2=80=94=20BIT-24927?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without ^~ the generic ~* regex block for static extensions matched first, falling back to root /opt/moneyflix/crm where no assets/ dir exists → 404 for all CSS/JS. ^~ /assets/ takes precedence over regex blocks, aliasing to crm/Views/assets/ where the complete asset set lives. Co-Authored-By: Paperclip --- scripts/moneyflix-crm-nginx.conf | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 scripts/moneyflix-crm-nginx.conf diff --git a/scripts/moneyflix-crm-nginx.conf b/scripts/moneyflix-crm-nginx.conf new file mode 100644 index 0000000..9201730 --- /dev/null +++ b/scripts/moneyflix-crm-nginx.conf @@ -0,0 +1,32 @@ +server { + listen 8080; + server_name _; + root /opt/moneyflix/crm; + index index.php; + + # ^~ stops regex matching; serves assets from Views/assets/ + location ^~ /assets/ { + alias /opt/moneyflix/crm/Views/assets/; + expires 1d; + access_log off; + } + + location / { + try_files $uri $uri/ /index.php$is_args$args; + } + + location ~ \.php$ { + include snippets/fastcgi-php.conf; + fastcgi_pass unix:/run/php/php8.1-fpm.sock; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include fastcgi_params; + } + + location ~* \.(js|css|png|jpg|ico|gif|svg|woff2?|ttf)$ { + expires 1d; + access_log off; + } + + location ~ /\. { deny all; } + location ~ \.env$ { deny all; } +} -- 2.47.3