1

I am on 14.04, Nginx was not accessed for weeks and all of a sudden the default index.html replaced the one we had. We checked logs and no one accessed Nginx except us just now to change it back. No updates were made as far as we are aware.

Another question was asked with the same problem (Nginx index.html gets overwritten with default index.html file) and it was suggested I ask a new question for this same problem.

The only "answer" I could find was from https://www.digitalocean.com/community/questions/my-index-html-file-in-nginx-automatically-gets-overwritten-with-the-nginx-defaul-index-html-file-for-no-reason that suggest changing the location of the html files from /usr/share/nginx to something else (I like /var/www/nginx) and then making the modification in the nginx/sites-enabled/conf file.

We made this modification in the server but we can only wait for it to happen again to know if it is the solution. If anyone can help figure it out it would be greatly appreciated.

Carobell
  • 155

1 Answers1

0

14.04 does not have the logic to 'fix' this in the package - that said that package is actually older than 14.04 was. This logic was introduced in Debian later than 14.04 to not clobber index files. The amount of changes to the post-installation statements would break things; this is why the logic wasn't added to the 14.04 package as a backport or update.

With regards to changing the docroot, if you change your document root to /var/www/something then the packaging won't clobber it. The packages don't touch /var/www/ in 14.04. They do touch /usr/share/nginx/... though and it's why this is a pitfall on the NGINX documentation to use the defaults.

You should be fine if you use the /var/www/... docroot.

Thomas Ward
  • 74,764