0
votes

i have a problem configuring nginx with an old PHP based CMS.

The PHP creates URLs like this one. http://mysite.com/img/s/58x45/upload/images/gallery/foto/032013/directory/06.jpg

Where img is the controller, s the action and 58x45 the size (to be cropped).

upload/images/gallery/foto/032013/directory/06.jpg is the path to the image. The path changes based on the directory in which the files are uploaded.

NGINX is trying to acces the images directly and gives me 404.

I would like to let the controller/action handle it. (crop/save/serve the image).

Any ideas?

1
witch CMS do you use?Alireza41
It is a custom build.I have inherited it.CodeIgniter based.tschelik
so you should configure CMS routing, check the CodeIgniter routingAlireza41
How did you configure nginx?Bart

1 Answers

1
votes

You can accomplish that by using rewrite in the server block of nginx:

rewrite   ^/img/s/(\d)+x(\d)+/(.)*$ /imageController/imageController.php?width=$1&height=$2&path=$3 last;

That would redirect it to the file /imageController/imageController.php with the width, height and path passed in as variables.