nginxconfiguration单独的位置和位置下

下面的代码是我的nginxconfiguration,现在如果我访问location /images/article1它会返回404找不到,怎么解决呢?

例如,定位/a/根到文件夹和位置b定义/a/b来别名另一个文件夹

我做了testing注释的location ~ ^/(images/|javascripts/|stylesheets/|fonts)然后将正确显示。

 location ~ ^/(images/|javascripts/|stylesheets/|fonts) { root /Sites/domain/app/assets; access_log off; expires max; } location /images/article1 { alias /Sites/sub.domain/app/assets/images/article1; access_log off; expires max; } 

 location /images/sub { root /Sites/sub.domain/app/assets; access_log off; expires max; } 

 location /sub/(images/|fonts) { root /Sites/sub.domain/app/assets; access_log off; expires max; } 

正则expression式的位置优先于前缀位置,除非使用^~修饰符。 尝试:

 location ^~ /images/article1 { ... } 

详情请参阅此文件 。