I have the LiipImagineBundle installed in my Symfony2 2.1.10 installation and I experience a little configuration problem with my nginx server. On the net I discovered this nice snippet as a great and simple nginx configuration for Symfony2 apps. I added some lines of code. Most importantly I want to be able to disable the access.log
for static files like images.
The following ruleset was working flawlessly:
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
expires 30d;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
access_log off;
}
But today I discovered that images generated by the LiipImagineBundle need to be accessed via the app.php
or the app_dev.php
. Otherwise they don't get generated and nginx logs the following error message:
[error] 28988#0: *733 open() "/[...].jpeg" failed (2: No such file or directory)
Which is basically a 404. The file doesn't get generated because it is not accessed via the Symfony2 application but directly.
I need a configuration that allows me to disable the access-logging and adding some caching headers to static files, but still serve them through the same route as before.
Is there a possible solution for that?