I'm using the PHPThumb script to resize image in a little slider/carousel on my blog, www.muylinux.com. I've completed the migration from Cherokee (we had problems with this webserver) to Nginx, but although almost everything is running fine, the carousel does not show the thumbnail generated by PHPThumb, although the image is in fact on the directory it links to.

For example, this is one of the images that should be shown currently:


And as you can see, the image is there:


But somehow it doesn't show on the homepage's carousel.

I'm pretty sure it's a matter of some rewrite rule, but I can't see how to solve this.

I've seen that the RewriteRule in Apache should be

RewriteRule ^(.*)$ index.php?thumb=$1 [L,QSA]

I'm not sure the "translation" to an nginx rule could work, but I guess there is a good chance for that to work.

Could someone try to give me the equivalent rewrite rule for Nginx? I've tried this:

rewrite ^/([^?]*)(?:\?(.*))? index.php?thumb=$1$2;

I'm a beginner on this and it has not worked.


It's a bit of a weird situation if I understand it right, normally you would not rewrite a request to a PHP file to index.php.

The best way to convert RewriteRule ^(.*)$ index.php?thumb=$1 [L,QSA] to Nginx configuration syntax is to use try_files $uri $uri/ /index.php?thumb=$request_uri;

You'd probably need it in your PHP location considering the request is to a PHP script. Might be easier to say if you posted your configuration file.

  • In fact I already had a rule similar to that one that solved a past issue with custom permalinks. Nginks and pretty permalinks on WordPress are not so "straightforward" as on Apache or even Cherokee. Anyway, the new line didn't solve the issue. My config file is as follows: pastebin.com/kPUqcxt9 – javipas Nov 28 '10 at 20:10
  • Plenty of things that's confusing in that Config, for instance your if checks to see if the file exists, those are completely nullified by the try_files. Also you haven't got it in your PHP location as I said to. See here: pastebin.com/j9EiwShR – Martin Fjordvald Nov 28 '10 at 21:29
  • I'm sorry, but didn't work. I've seen the duplicated try_files rule, so I guess one disables the other. Anyway, the problem stays the same: the phpThumb does not find the image, although the path is correct. – javipas Nov 29 '10 at 9:26

There was finally no need to include a new rewrite rule in order to solve the problem.

The path and the image wasn't found because the plugin directory had not execution permissions.

So in case anyone deals with this issue, just access your WordPress installation,

cd blog_path/wp-content/themes/theme_name

And in my case, inside that folder I had a 'scripts' subfolder which contained the phpThumb scripts. So from that path,

chmod 755 -R scripts/

And... problem solved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.