Creating the Directory Structure - static content

Francis Daly francis at daoine.org
Sun Feb 21 15:17:24 UTC 2021


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


More information about the nginx mailing list