nginx正则expression式的位置不匹配

我有下面的位置,这是一个更大的conf文件。

作为参考,这工作:

location = /scripts/news/admin/index.js { alias /my/file/path/news/scripts/admin/index.js; } 

但是,这不能拿起正则expression式(作为一个testing我强制文件path,但它仍然没有使用):

 location ^~ ^/scripts/([az]+)/([az]+)/([az]+).js$ { alias /my/file/path/news/scripts/admin/index.js; # for testing, use direct file location break; # ensuring nothing else happens, for testing #alias /my/file/path/$1/scripts/$2/$3.js; # actual regex } 

我在我的正则expression式中明显缺less一些明显的东西吗? 我试过(.*)~*但是没有任何区别。 正在使用的url是:

http://example.com/scripts/news/admin/index.js

在我的日志中,我看到:

 2015/03/21 20:43:28 [debug] 16440#0: *183689 test location: "^/scripts/(\w+)/(\w+)\.js$" 2015/03/21 20:43:28 [debug] 16440#0: *183689 test location: "/" 2015/03/21 20:43:28 [debug] 16440#0: *183689 test location: "scripts/([az]+)/([az]+)/([az]+).js" 2015/03/21 20:43:28 [debug] 16440#0: *183689 test location: "thirdparty" 2015/03/21 20:43:28 [debug] 16440#0: *183689 test location: "skins" 2015/03/21 20:43:28 [debug] 16440#0: *183689 test location: ~ "\.(jpg|jpeg|gif|css|png|js|ico|html)$" 2015/03/21 20:43:28 [debug] 16440#0: *183689 using configuration "\.(jpg|jpeg|gif|css|png|js|ico|html)$" 

为什么不是第三项进入和停止?

我推测正则expression式首先是最具体的,而不是先写顺序。 在我的日志中显示的最后一个正则expression式匹配和停止。