Remember that Nginx reported an error: [error] open()

Recently, I need to use a virtual machine to practice a project. Because there are different computers, I created a virtual machine on one computer and copied it directly to another computer. I thought it would be enough to change the IP address. Who knows that I am using it A problem was encountered with the service in the virtual machine, which prevented the host from accessing the service in the virtual machine. After checking the configuration files of related services, no problems were found, so I thought that there might be a problem with the Nginx configuration in the virtual machine, so I checked the Nginx configuration files, and found no problems; restart Nginx with a rigorous attitude. After typing it out nginx -s reload, I found that Nginx did not restart, but reported an error.
insert image description here
Of course, this time is the time to sacrifice Baidu Dafa.
The reason is simple, even if the file is missing nginx.pid, the reason for this problem is: Nginx cannot find where the configuration file is.
Solution:
Use the nginx -c parameter to specify the location of the nginx.conf file.
insert image description here
Reference article: nginx two error solutions for reload

Guess you like

Origin blog.csdn.net/zhoulizhu/article/details/89738809