nginx: [error] open() “/usr/local/nginx/logs/“ failed (2: No such file or directory)

An error was reported when starting nginx: nginx: [error] open() “/ usr/local/nginx/logs/ ”Failed (2: no such file or directory)
are different every time I encounter them. I have encountered two solutions here, and I’d like to share them here

Situation 1: nginx.conf Of Annotated
Enter nginx.conf Catalog editor

sudo vi /usr/local/nginx/conf/nginx.conf

Just cancel the comments and restart nginx

sudo nginx -s reload 

Case 2: no configuration directory is specified

Enter to use the specified nginx.conf Restart nginx in the form of file (first, make sure that the PID in the first case is not commented, otherwise it may be opened for the first two times, but an error will still be reported later)

sudo /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf


Read More: