fix(nginx): add ^~ /assets/ alias to serve Views/assets/ — BIT-24927

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 <[email protected]>
This commit is contained in:
XikaandPaperclip committed 2026-06-10 19:04:40 +00:00
1 parent 7a6f91f7b6
commit 6f5d68eefd
1 file changed
+32
+32
View File
@@ -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; }
}