My index.html file in Nginx automatically gets overwritten with the Nginx defaul index.html file for no reason.

November 5, 2016 86 views
Nginx Linux Commands

I'm running Nginx on Ubuntu 14.04. I have my website installed in the default /usr/share/nginx/html directory. My website works fine for several days and then the system automatically overwrites my websites index.html file with the default Nginx "Welcome to nginx!" index.html file. I have to go back and copy my website’s index.html file again in order for my website to work. I've had my website up for a couple of weeks now and this has happened three times. My website will work for a few days and then my index.html file will get overwritten. There is no method to the madness. Does anyone know what might be causing this to happen?

1 Answer

By chance are you running automatic updates or any other automated process on your droplet? Hearing this, my first thought would be that the nginx index.html file is being cached somewhere causing you to see it in the browser but if you're able to confirm that the file itself has changed via ssh then that would not be the case. Updates should not change the file but /usr/share is not always a location that apt packages will respect changes in. You may want to try copying your files to a different location and updating your configuration in /etc/nginx/sites-enabled/default to point to the new location.

Have another answer? Share your knowledge.