Welcome! Log In Create A New Profile

Advanced

Re: Root ignored for "location = /"?

Valentin V. Bartenev
February 06, 2014 10:24AM
On Friday 07 February 2014 01:32:44 Mark James wrote:
> Hello,
>
> I want the index.html file in a particular directory to only be served when
the domain's root URI is requested.
>
> Using the config
>
> server example.com;
> index index.html;
> location = / {
> root path/to/dir;
> }
>
> a request to example.com results in index.html in the Nginx default root
"/html" directory being served.
>
> The same thing happens with a trailing slash on the root, or when I
substitute a trailing-slash alias directive.
>
> If I use an alias directive without a trailing slash I get 403 error
>
> directory index of "path/to/dir" is forbidden.
>
> There are no problems if I instead use "location /".
>
> Can anyone suggest a reason or a resolution?


The reason is documented: http://nginx.org/r/index

"It should be noted that using an index file
causes an internal redirect ..."

wbr, Valentin V. Bartenev

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Root ignored for "location = /"?

Mark James February 06, 2014 09:34AM

Re: Root ignored for "location = /"?

Valentin V. Bartenev February 06, 2014 10:24AM

Re: Root ignored for "location = /"?

Mark James February 06, 2014 10:54AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 121
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready