I've a problem with nginx configuration (that i get working with apache). I've to do a rewrite so I've configured:
location = / {
root /var/www/domain.tld/public_html;
index index.php;
}
location / {
root /var/www/domain.tld/public_html;
index index.php;
if (!-f $request_filename) {
rewrite ^(.*)$ /index.php last;
break;
}
if (!-d $request_filename) {
rewrite ^(.*)$ /index.php last;
break;
}
}
# serve static files directly
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|wmv)$ {
access_log off;
expires 30d;
}
The problem is that I've static files located in dirs like /css, /img, /js but I also have a php controller that serves the user uploaded files and has the structure: domain.tld/media/image/NAME/EXTENSION. This doesn't works because it tries to get a static file, but If I go with domain.tld/media/image/NAME/EXTENSION/ (note the final /) it works.
How I can solve this?
Thank you in advance!