Answer the question
In order to leave comments, you need to log in
How to cache only design assets in Laravel using nginx?
Next block: location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$
Caches all resources with the specified extensions.
I would like only resources from the /public/build folder to be juggled
. there are dynamic pictures, the variability of which is quite frequent.
I refer to these resources ala:
/build/front/images/1.png
/build/admin/css/app.css
server
{
listen 80;
server_name www.domen.com;
index index.php index.html;
root /var/www/public;
location / {
try_files $uri /index.php?$args;
}
location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
access_log off;
expires max;
log_not_found off;
}
}
Answer the question
In order to leave comments, you need to log in
Above the \.(jpg|jpeg|gif|css|png|js|ico|html)$ block, add a block with ^/build/.*\.(jpg|jpeg|gif|css|png|js|ico|html) $
server
{
...
location ~* ^/build/.*\.(jpg|jpeg|gif|css|png|js|ico|html)$ {
access_log off;
expires max;
log_not_found off;
}
location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
access_log off;
log_not_found off;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question