Performance question regarding regex

panni nginx-forum at nginx.us
Fri Jul 16 05:18:33 MSD 2010


Dear forums/mailing list,

just a quick question:

[code]location / {
            root /home/folder/www;
            index  index.php;
            #if (!-e $request_filename) {
            if ($request_filename !~*
^.+\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|swf)$)
            {
                #rewrite ^(.*)$ /index.php?q=$1 last;
                rewrite ^.*$ /index.php last;
                break;
            }
            root /home/folder/www;
            expires 30d;
            break;
        }

[/code]

What would be faster here. Using the commented "#if (!-e
$request_filename) {" or the explicit filetype matching?


Thank you in advance!

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,109438,109438#msg-109438




More information about the nginx mailing list