server_name & redirect

Christophe de Kerviler kerviler at leguide.com
Fri Jul 25 20:21:31 MSD 2008


Hi,

I would like to have multiple domains on nginx to manage images. If one 
image is not available, I redirect to a php processing the image. On the 
next call the image will be available.

My conf looks like this:

 server {
        listen       80;
        server_name img.domain1.com img.domain2.com img.domain3.com
.....

and this something like this:

if (! -f  $myimagefile) {
  
    rewrite /process.php?param=some_parameters redirect;
    break;
}

My problem is if I call img.domain2.com and if the image is not there, 
I'am redirected to img.domain1.com/process.php...
instead of domain2.com/process.php

The first domaine behind "server_name". Is there a solution for that, or 
a work around?

Thanks a lot.

Christophe







More information about the nginx mailing list