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]>
33 lines
779 B
Plaintext
33 lines
779 B
Plaintext
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; }
|
|
}
|