Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web Server Root Path #60

Open
excalq opened this issue Mar 23, 2022 · 1 comment
Open

Web Server Root Path #60

excalq opened this issue Mar 23, 2022 · 1 comment

Comments

@excalq
Copy link

excalq commented Mar 23, 2022

First I'd like to pay a compliment to the very well put together Docker base image you've created. Nicely done, and thank you.

Regarding /usr/share/nginx/html, as the web root directory, though this may sound very pedantic, I wanted to point out a bit of history informing the choice of web root paths, which are typically /var/www in most Linux distributions, including Debian. In contrast, this project uses /usr/share/nginx/html, the Nginx package's installed location for default HTML files.

In the 1994 Filesystem Hierarchy Standard[0] (The "standard guidelines for file and directory placement under UNIX-like operating systems"), it's noted that:

/var contains variable data files [...] /var is specified here in order to make it possible to mount /usr read-only. Everything that once went into /usr that is written to during system operation (as opposed to installation and software maintenance) must be in /var.

However, note that Nginx does correctly use /usr/share as the location to place it's "read-only" package installed data/sample files.[1]

Any program or package which contains or requires data that doesn't need to be modified should store that data in /usr/share. [...] It is recommended that a subdirectory be used in /usr/share for this purpose.

The FHS Standard makes this example for games:

Game data stored in /usr/share/games must be purely static data. Any modifiable files, such as score files, game play logs, and so forth, should be placed in /var/games.

An insightful discussion can be found on StackOverflow[2].

[0] https://www.pathname.com/fhs/pub/fhs-2.3.html#PURPOSE31
[1] https://www.pathname.com/fhs/pub/fhs-2.3.html#USRSHAREARCHITECTUREINDEPENDENTDATA
[2] https://unix.stackexchange.com/questions/47436/why-is-the-root-directory-on-a-web-server-put-by-default-in-var-www

@excalq
Copy link
Author

excalq commented Mar 23, 2022

All that said, it's easy enough to just override the web root in one's own Nginx config, in a Dockerfile that extends this project's image:

FROM wyveo/nginx-php-fpm:php81
...
COPY . /var/www

COPY ./docker-files/nginx.conf /etc/nginx/conf.d/website.conf
RUN rm -rf /etc/nginx/conf.d/default.conf

Perhaps an example in the README.md could illustrate this well. I'll be happy to contribute mine when it's ready. It also does npm install and composer install during the build. This would help resolve issue #40 as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant