Creating the Directory Structure - static content

Grzegorz Cześnik grzegorz.czesnik at hotmail.com
Mon Feb 22 14:12:08 UTC 2021


My nginx distribution is from the official nginx repository for Ubuntu 20 Server

Default:
    location / {
        root / usr / share / nginx / html;
        index index.html index.htm;
    }

Therefore, I prefer to change it.

Grzegorz

-----Original Message-----
From: nginx [mailto:nginx-bounces at nginx.org] On Behalf Of Francis Daly
Sent: Sunday, February 21, 2021 4:17 PM
To: nginx at nginx.org
Subject: Re: Creating the Directory Structure - static content

On Wed, Feb 17, 2021 at 05:05:42PM +0000, Grzegorz Cześnik wrote:

Hi there,

> /var/www/<domain_name>/public_html
> /var/www/html/<domain_name>
> /var/www/<domain_name>
> 
> Are there any benefits to using one of these examples? Is it any freedom in what they write about it?

It is "whatever organisation you prefer" -- the nginx application does not care what that organisation is, so long as it is told what it is, probably by using the "root" directive.

From a "belt-and-braces" security perspective, I find it good to ensure that whatever directory is chosen as a "root", *everything* within that directory is ok for nginx to serve as-is from the filesystem.

That is -- I don't put top-secret-password-file inside that directory and then hope that no-one asks for it; and I don't put secret-source-code.php inside that directory and then hope I remember to add config telling nginx not to serve it directly.

But they are unrelated to what directory structure to use.

If you use a distribution, and that has a preferred layout, use that unless you have a reason not to.

Cheers,

	f
-- 
Francis Daly        francis at daoine.org
_______________________________________________
nginx mailing list
nginx at nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx


More information about the nginx mailing list