nginx's bug(alias and $request_uri to conflict)

Simon Liu simohayha.bobo at gmail.com
Mon Oct 11 09:56:32 MSD 2010


thank you!

On Mon, Oct 11, 2010 at 1:06 PM, Igor Sysoev <igor at sysoev.ru> wrote:

> On Mon, Oct 11, 2010 at 10:46:28AM +0800, Simon Liu wrote:
>
> > thanks!
> >
> > my nginx version is 0.8.52, index.html in /home/my_name/tools/nginx/html/
> > , this is my nginx config:
> >
> >  worker_processes  1;
> >
> > error_log  logs/error.log  debug;
> > events {
> >     worker_connections  1024;
> > }
> > http {
> >     include       mime.types;
> >     default_type  application/octet-stream;
> >     expires         1y;
> >     sendfile        on;
> >     server {
> >         listen       8080;
> >         server_name  localhost;
> >         location ~*  ^/html/(.+\.html)$ {
> >             alias   /home/my_name/tools/nginx/html/$1;
> >             if ($request_uri ~ \.(html|htm|shtml)$) {
> >                 expires     1h;
> >             }
> >         }
> >         error_page   500 502 503 504  /50x.html;
> >         location = /50x.html {
> >             root   html;
> >         }
> >     }
> > }
>
> 1) wiki.nginx.org/IfIsEvil
>
> 2) location ~*  ^/html/(.+\.html)$ {
>       alias   /home/my_name/tools/nginx/html/$1;
>
>    it's better to change to just
>
>   location ~*  ^/html/.+\.html$ {
>      root   /home/my_name/tools/nginx;
>
> 3) ...|shtml)$ is not matched by \.html)$
>
> 4) regex is usele here, so
>
>         location  /html/ {
>             root   /home/my_name/tools/nginx;
>             expires     1h;
>        }
>
>
> --
> Igor Sysoev
> http://sysoev.ru/en/
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
>



-- 
博观约取

豆瓣:www.douban.com/people/mustang/

blog: www.pagefault.info

twitter: www.twitter.com/minibobo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20101011/9b6cc10e/attachment.html>


More information about the nginx mailing list