If nginx service is giving following error  :

 

nginx: [alert] could not open error log file: open() “/var/log/nginx/error.log” failed (2: No such file or directory)
2018/08/25 16:10:52 [emerg] 1762#1762: open() “/var/log/nginx/access.log” failed (2: No such file or directory)

 

Then it means that your nginx is either not able to access the particular files/directory or you have deleted them.

 

If the folder ‘nginx’ doesn’t exist then use the following commands from root user ;

cd /var/log
mkdir nginx

 

In case the directory and files exist then you need to change their user permission as per your nginx user.

Following commands might help :

sudo chown -R www-data:www-data /var/log/nginx;
sudo chmod -R 755 /var/log/nginx;

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)