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.
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.