On 18/11/2013 6:26 PM, Francis D. wrote:
Thanks for your response.
(You can possibly avoid that if you use something like
…/dhe403.shtml/$request_uri and handle it appropriately on the far
side.)
Ok.
It would seem easier to either proxy_pass or fastcgi_pass to the old
server, in an error_page 403 location on the new server, if you’re happy
to have that level of not-just-static involved (and not happy to run
the full php suite on the new server).
That way, the browser would get one redirect to the intended destination
instead of one to an intermediate location first.
Just to clarify, the two “servers” are on same physical box with the
same document root, just migrating to a better host. So php is
installed. I’m just creating two server blocks so that the images will
be served on a cookieless sub-domain for web performance reasons, i.e.:
server {
server_name www.example.com;
…
}
server {
server_name static.example.com;
…
}
On the www block, I currently have this 403 block:
error_page 403 = /dhe403.shtml;
location = /dhe403.shtml {
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_cache off;
}
So I could add that to my static block as well?
Also, I’d have this “rewrite anything not static” location in the static
server:
if ($request_uri !~*
“.(gif|js|jpg|jpeg|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|mov)$”)
{
rewrite ^(.*) http://www.example.com$1 permanent;
break;
}
If I put the 403 location before it, will it still redirect any
non-static files EXCEPT for the dhe403.shtml?
Thanks!