This is a new install in which nginx previously started and stopped normally. I believe this error arose after enabling server blocks which tested (nginx -t) successfully. I then tried to restart nginx and received this error:
nginx: [emerg] open() "/usr/share/nginx/on" failed (13: Permission denied)
The file "on" did not exist prior to the attempted restart. It was just created and is empty. When I restart php-fmp (successfully) and then try to restart nginx, the error changes to:
nginx: [emerg] open() "/var/run/nginx.pid" failed (13: Permission denied)
nginx: configuration file /etc/nginx/nginx.conf test failed
But again, when I run nginx -t, I get:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
I thought it might be a user issue but it is running as nginx:
# ps -elf | grep nginx
5 S nginx 2774 2773 0 80 0 - 234152 skb_re 22:07 ? 00:00:00 php-fpm: pool www
5 S nginx 2775 2773 0 80 0 - 234152 skb_re 22:07 ? 00:00:00 php-fpm: pool www
5 S nginx 2776 2773 0 80 0 - 234152 skb_re 22:07 ? 00:00:00 php-fpm: pool www
5 S nginx 2777 2773 0 80 0 - 234152 skb_re 22:07 ? 00:00:00 php-fpm: pool www
5 S nginx 2778 2773 0 80 0 - 234152 skb_re 22:07 ? 00:00:00 php-fpm: pool www
0 R root 2940 2472 0 80 0 - 25811 - 22:18 pts/0 00:00:00 grep nginx
Also, using sudo nginx -t does not change anything. What is also odd is the fact that there is a nginx.pid even though nginx is not running. Deleting the pid file simply changes the error message back to:
nginx: [emerg] open() "/usr/share/nginx/on" failed (13: Permission denied)
Deleting the on file makes no difference either.
Make sure you are running as a superuser.
sudo nginx -t
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With