URL rewriting: last versus break
mike
mike503 at gmail.com
Fri Jul 4 12:32:06 MSD 2008
On 7/3/08, Roxis <roxis at list.ru> wrote:
> wiki didn't help?
>
> location / {
> rewrite ^/foo$ /foo.php last;
> rewrite ^/bar$ /bar.php break;
> }
>
> location ~ \.php$ {
> proxy_pass ...;
> }
>
> request /foo will return proxy_pass response ("location ~ \.php" will be used)
> request /bar will return source code of foo.php ("location /" will be used)
doesn't this mean my current approach is overkill?
server {
listen 80;
server_name foo.com;
index index.php index.html;
root /home/foo/web/foo.com/;
include /etc/nginx/defaults.conf;
location ~ \.php {
fastcgi_pass 127.0.0.1:11002;
fastcgi_index index.php;
}
location /admin {
auth_basic "private";
auth_basic_user_file /home/foo/web/foo.com/.htpasswd;
location ~ \.php {
fastcgi_pass 127.0.0.1:11002;
fastcgi_index index.php;
}
}
}
according to what it sounds like above, i could do this right the
right keywords (break vs. last) in the right spots.
i need php to execute under the location /admin directory... i posted
this question a couple weeks ago, but it sounds like it might be
doable using the strategy above. however, which goes where?
do i have to use some sort of rewrite to trigger it all?
More information about the nginx
mailing list