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

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?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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.