Hi On Mon, Oct 10, 2016 at 1:19 PM, Edho Arief <m...@myconan.net> wrote:
> Made a bit more compact but still using ifs. > > location / { > location ~ /$ { > error_page 418 = @dirlist; > > if (-d $request_filename) { > set $index_fallback A; > } > > if (!-f $request_filename/index.html) { > set $index_fallback "${index_fallback}B"; > } > > if ($index_fallback = AB) { > return 418; > } > } > } > > On Mon, Oct 10, 2016, at 15:08, Edho Arief wrote: > > Hi, > > > > On Mon, Oct 10, 2016, at 12:56, Edho Arief wrote: > > > I somehow can't make this scenario work: > > > > > > root structure: > > > /a/index.html > > > /b/ <-- no index.html > > > > > > accessing: > > > 1. site.com/a -> redirect to site.com/a/ -> show /a/index.html > > > 2. site.com/b -> redirect to site.com/b/ -> show @fallback > > > > > > > > > > _______________________________________________ > nginx mailing list > nginx@nginx.org > http://mailman.nginx.org/mailman/listinfo/nginx > Still need more locations, but independent to directories you want to access: server { listen 7770; root /tmp; autoindex on; autoindex_format json; } server { listen 80; server_name localhost; index index.html; root /tmp; location ~ /.*?[^/]$ { try_files $uri @redir; } location @redir { return 301 $uri/; } location ~ /$ { try_files $uri"index.html" @reproxy; } location @reproxy { proxy_pass http://localhost:7770; } } -- regards, Nurahmadie --
_______________________________________________ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx