Welcome! Log In Create A New Profile

Advanced

Re: Root inside Location Block? Pitfalls says NO, Beginner’s Guide says YES

Maxim Dounin
September 19, 2013 07:30AM
Hello!

On Thu, Sep 19, 2013 at 06:57:35AM -0400, chrisrob wrote:

> Practically the first two pages I read when starting with nginx were:
>
> http://wiki.nginx.org/Pitfalls
>
> which says "putting Root inside Location Block is BAD" - don't do it.
>
> and
>
> http://nginx.org/en/docs/beginners_guide.html
>
> which gives this as its example of a config file:
>
> The resulting configuration of the server block should look like this:
>
> server {
> location / {
> root /data/www;
> }
> location /images/ {
> root /data;
> }
> }
>
> So I'm wondering which is right?

As you can see, the example in begginners guide uses _different_
roots for locations configured, and hence it's very different from
the example provided at Pitfalls wiki page.

Using the "root" directive inside a location block isn't bad per
se. It's bad if you repeat it needlessly instead of using single
root inside a server{} block.

--
Maxim Dounin
http://nginx.org/en/donation.html

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

Root inside Location Block? Pitfalls says NO, Beginner’s Guide says YES

chrisrob September 19, 2013 06:57AM

Re: Root inside Location Block? Pitfalls says NO, Beginner’s Guide says YES

Maxim Dounin September 19, 2013 07:30AM

Re: Root inside Location Block? Pitfalls says NO, Beginner’s Guide says YES

chrisrob September 19, 2013 08:20AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 104
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready