Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why change NGINX file locations?

Almost every example I have seen, of people configuring NGINX (mostly with Docker), changes the default file and folder locations. Can someone think of a legitimate reason for this other than personal preference (ex: moving to the industry recognized location for such items)?

Two of the example changes I am seeing are...

1. HTML Location (Root)
The HTML root is being replaced from ...

/use/share/nginx/html/

... to ...

RUN mkdir /srv/www
COPY static-content /srv/www

2. Logs Location
Common log locations are replaced from ...

/var/log/nginx/
/var/log/nginx/error.log
/var/log/nginx/access.log

... to ...

RUN mkdir /etc/nginx/logs \
    && touch /etc/nginx/logs/static.log \
    && touch /etc/nginx/logs/error.log \
    && touch /etc/nginx/logs/access.log

I'm certainly no expert on etiher Docker nor the Linux file system. I'm just curious if there is some benefit to doing this... again, other than personal preference.

like image 572
Fred Lackey Avatar asked Oct 29 '22 12:10

Fred Lackey


1 Answers

Partial answer: The Filesystem Hierarchy Standard for UNIX-like operating systems suggests that data served by the system is to be found in /srv.

Why someone would move log files to /etc, which is often recommended to be mounted read-only for security-reasons, I don't understand. Hopefully someone else can shed some light on this!

like image 117
cfromme Avatar answered Nov 15 '22 05:11

cfromme