<div dir="ltr">Hi,<br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 10, 2016 at 1:39 PM, Edho Arief <span dir="ltr"><<a href="mailto:me@myconan.net" target="_blank">me@myconan.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<span class=""><br>
On Mon, Oct 10, 2016, at 15:29, Nurahmadie Nurahmadie wrote:<br>
> Hi<br>
><br>
</span><span class="">> > On Mon, Oct 10, 2016, at 15:08, Edho Arief wrote:<br>
> > > Hi,<br>
> > ><br>
> > > On Mon, Oct 10, 2016, at 12:56, Edho Arief wrote:<br>
> > > > I somehow can't make this scenario work:<br>
> > > ><br>
> > > > root structure:<br>
> > > > /a/index.html<br>
> > > > /b/ <-- no index.html<br>
> > > ><br>
> > > > accessing:<br>
> > > > 1. <a href="http://site.com/a" rel="noreferrer" target="_blank">site.com/a</a> -> redirect to <a href="http://site.com/a/" rel="noreferrer" target="_blank">site.com/a/</a> -> show /a/index.html<br>
> > > > 2. <a href="http://site.com/b" rel="noreferrer" target="_blank">site.com/b</a> -> redirect to <a href="http://site.com/b/" rel="noreferrer" target="_blank">site.com/b/</a> -> show @fallback<br>
> > > ><br>
><br>
</span><span class="">> Still need more locations, but independent to directories you want to<br>
> access:<br>
><br>
><br>
>     server {<br>
>             listen 7770;<br>
>             root /tmp;<br>
>             autoindex on;<br>
>             autoindex_format json;<br>
>     }<br>
><br>
>     server {<br>
>             listen       80;<br>
>             server_name  localhost;<br>
>             index index.html;<br>
>             root /tmp;<br>
><br>
>             location ~ /.*?[^/]$ {<br>
>                     try_files $uri @redir;<br>
>             }<br>
><br>
>             location @redir {<br>
>                     return 301 $uri/;<br>
>             }<br>
><br>
>             location ~ /$ {<br>
>                     try_files $uri"index.html" @reproxy;<br>
>             }<br>
><br>
>             location @reproxy {<br>
>                     proxy_pass <a href="http://localhost:7770" rel="noreferrer" target="_blank">http://localhost:7770</a>;<br>
>             }<br>
>     }<br>
><br>
<br>
</span>Thanks, but that's even longer than my ifs. Also one `server { }` and<br>
one regexp location too many.<br>
<div class="HOEnZb"><div class="h5"><br>
______________________________<wbr>_________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/<wbr>mailman/listinfo/nginx</a><br>
</div></div></blockquote></div><br></div><div class="gmail_extra">Ah, sorry I thought it's obvious that the other server is just served as dummy example,<br></div><div class="gmail_extra">also I have this tendency to avoid `if` as much as possible, so yeah<br clear="all"></div><div class="gmail_extra"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">regards,<br>Nurahmadie<br>--<br></div>
</div></div>