#sub_path_only rewrite ^/$ / permanent; location /lists/idx { alias $root/; index false; autoindex on; autoindex_localtime off; autoindex_format jsonp; } location /stats { autoindex off; alias /var/www/awesm/stats; } location /style { autoindex off; alias /var/www/awesm/style; } location = / { add_header x-loc "/ exact"; root $root; try_files /index /index.html; } #location ~* ^/lists { location / { add_header x-loc "/ wild"; root $root; try_files $uri $uri.html /redirect?q=$uri; } location /search { set $args $args&pretty; proxy_pass http://[::1]:9876; } location /redirect { proxy_pass http://[::1]:9876; }