Question

Nginx 1.12.2.3 to Nginx 1.16.1.1 wrote to the index.html file

Posted February 7, 2020 239 views
Nginx

Hello all, I did a yum update on my Development server and it updated Nginx 1.12.2.3 to Nginx 1.16.1.1. Also in the process it wrote to the index.html file.

This is of concern as if updates are run on a production server it could cause problems in that it could make the website crash as nginx appear to be writing to the public folder.

Here is how the /usr/share/nginx/html looks before the yum update versus after.

-rw-r–r– 1 root root 2811 May 10 2019 poweredby.png
-rw-r–r– 1 root root 368 May 10 2019 nginx-logo.png
-rw-r–r– 1 root root 3700 May 10 2019 index.html
-rw-r–r– 1 root root 3693 May 10 2019 50x.html
-rw-r–r– 1 root root 3650 May 10 2019 404.html

Here is how it looks after the YUM update and reboot.
lrwxrwxrwx 1 root root 20 Jan 24 18:28 en-US -> ../../doc/HTML/en-US
lrwxrwxrwx 1 root root 18 Jan 24 18:28 img -> ../../doc/HTML/img
drwxr-xr-x 2 root root 26 Jan 24 18:28 icons
lrwxrwxrwx 1 root root 14 Jan 24 18:28 poweredby.png -> nginx-logo.png
lrwxrwxrwx 1 root root 25 Jan 24 18:28 index.html -> ../../doc/HTML/index.html

So the question is why is YUM/NGINX writing files to the public folder? As I said this is a concern in that it could bring the whole website down. Any help, thoughts or suggestions would be welcome.

Regards,
Patrick

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/#using-the-default-document-root

...
You should not use the default document root for any site-critical files. There is no expectation that the default document root will be left untouched by the system and there is an extremely high possibility that your site-critical data may be lost upon updates and upgrades to the NGINX packages for your operating system.
...

Avoid using default site config and file directories.
Otherwise, the updates may clobber your existing files.

Submit an Answer