Documentation / Beginner's Guide error

Maxim Dounin mdounin at mdounin.ru
Wed Jul 23 17:52:27 UTC 2014


Hello!

On Wed, Jul 23, 2014 at 01:35:31PM -0400, ericreiss wrote:

> Just getting started with NGINX and reading the Beginner's Guide.
> 
> The guide says to create two directories:
> /data/www 
> /data/images 
> 
> Then goes on to tell you to setup two locations:
> location / {
>     root /data/www;
> }
> 
> and 
> 
> location /images/ {
>     root /data;
> }
> 
> Then says the results should look like this:
> 
> server {
>     location / {
>         root /data/www;
>     }
> 
>     location /images/ {
>         root /data;
>     }
> }
> 
> Isn't the second location root path incorrect?  It is missing the /images
> subfolder.

It is correct.  The "root" directive specifies a path to be added 
to a request URI, and a request to "/images/foo" will map to 
"<root>/images/foo".  Hence "/data" is correct value for the root 
if you want to return "/data/images/foo" in a response.

See http://nginx.org/r/root for details.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx mailing list