How to prevent the "off" file being created in the "nginx" folder

How to stop the "off" file logging nginx errors

Today, I would like to talk about something about nginx. If you built your website using LNMP, you may run into such a problem. There is an "off" file in the "nginx" folder and it records nginx errors. You don't know why this "off" file was created and want to stop it from logging errors. Please continue reading this post and I will tell you why and help you solve it.

How to solve the problem

If you want to turn off nginx error logging, you should write "error_log /dev/null;" in the nginx configuration file. Note "error_log off;" is not a valid syntax to turn off error logging and it will log errors in an "off" file. This is where the problem lies. Therefore, please find "error_log off;" in the nginx.conf file and correct it. Then, restart nginx. Delete the "off" file and it will not be created any longer. After checking code lines, you might wonder why you have this problem even though there are no "error_log off;" entries in your nginx.conf. In this case, there must be the code line "include /.../*.conf;" in your nginx.conf and these .conf files contain "error_log  off;". This will also make the "off" file created in the "nginx" folder. Go through these .conf files included in your nginx.conf and you will find "error_log off;". Change "error_log off;" to "error_log /dev/null;". Stop nginx, delete the "off" file, start nginx, and the "off" file will no longer be created.

Conclusion

The problem mentioned in this article is easily fixed. But, it is a little difficult for nginx beginner users to find out the reason causing the problem. If your friends are also encountering this problem, share this post with them.

Recommended Reading

How to delete the blobs.bin file

How to prevent the ".thumbnails" folder being created in the "DCIM" directory

How to solve "Your clock is ahead"

How to lower the version of an Android app

How to disable Windows 10 update thoroughly

How to open a WebP file in Photoshop and Windows Photo Viewer

Two methods to unlock the "Index" layer

How to watermark your photos to protect your copyright

How to annotate an image without any hassle

Avatar for Dong Liu
Dong Liu

Software tech makes life more convenient and helps people manage work in a more efficient way. As a tech geek, I select practical gadgets and share you with them. Should you have any advice, please feel free to let me know.

Leave a comment

Your email address will not be published. Required fields are marked with *