CentOS 6.6 with Nginx 1.6.2 - Suddenly can't restart nginx - nginx: [emerg] open() “/usr/share/nginx/on” failed (13: Permission denied)

nginx: (emerg) open failed (2: no such file or directory)
cannot create etc/nginx/nginx conf permission denied
nginx: (emerg) bind() to 0.0 0.0 443 failed (13: permission denied)
nginx permission denied
var/run/nginx pid failed (13: permission denied docker)
nginx user
run nginx as root
nginx: (emerg) open() /etc/nginx/nginx/conf failed (2: no such file or directory)

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

CentOS 6.6 with Nginx 1.6.2 - Suddenly can't restart , Make sure you are running as a superuser. sudo nginx -t. But again, when I run nginx -t, the test is successful: 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 everything seems fine: # ps -elf | grep nginx 5 S nginx 2774 2773 0 80 0 - 234152 skb_re 22:07 ?


Run getenforce to check SELinux mode. If it says Enforcing, then temporarily set the mode to Permissive by running setenforce 0, and see if your application works afterwards.

CentOS 6.6 with Nginx 1.6.2 - Suddenly can't restart nginx - iOS, CentOS 6.6 with Nginx 1.6.2 - Suddenly can't restart nginx - nginx: [emerg] open() “/usr/share/nginx/on” failed (13: Permission denied) - nginx. 5 CentOS 6.6 with Nginx 1.6.2 - Suddenly can't restart nginx - nginx: [emerg] open() "/usr/share/nginx/on" failed (13: Permission denied); View more network posts


I had similar issue

nginx: [emerg] open() "/etc/nginx/conf.d/websites.conf" failed (13: Permission denied) in /etc/nginx/nginx.conf:36.

The reason of the issue was provisioning configuration files over the SSH under specific user. Here is how I fixed it (what I did besides chmod/chown).

If selinux is enabled (which is by default in Centos) then

ls -Z /path/to/file 

must display "httpd_sys_content_t" as security context. If you encountering something like "user_home_t" you need to update this with running:

chcon -v --type=httpd_sys_content_t /path/to/file 

After that restart "nginx" or "httpd" as usual.

Reference https://wiki.centos.org/HowTos/SELinux

nginx suddenly starts to throw permission denied to /var/lib/nginx, log" failed (13: Permission denied) CentOS 6.6 with Nginx 1.6.2 - Suddenly can't restart nginx - nginx: [​emerg] I've got nginx 0.7x + PHP-FPM  How To Secure Nginx with Let's Encrypt on Ubuntu 20.04. Let's Encrypt is a Certificate Authority (CA) that provides an easy way to obtain and install free TLS/SSL certificates, thereby enabling encrypted HTTPS on web servers.


403 Forbidden nginx/1.6.3 (centos 6.6), CentOS 6.6 with Nginx 1.6.2 - Suddenly can't restart nginx - nginx: [emerg] open() “/usr/share/nginx/on” failed (13: Permission denied). Nginx, Prestashop - TTFB too much slow. Hello DO community, I have installed nginx as web server for my prestashop store I activated all cache (in prestashop back-office), But I get an TTFB (Time To First Byte) so slow.. like 8sec :( I don't know where I can checked to


Nginx 1.6.2, After that I changed index.php file to 777 for both root and nginx user but it always show forbidden error. Could you please help me to explain how  NGINX 1.15.10 can listen on a range of ports with both the HTTP and Stream modules, implementing a commonly requested feature for FTP proxying. Maturity of the JavaScript Module The NGINX JavaScript module (njs) is a convenient scripting extension to NGINX, and offers a range of advanced use cases by extending NGINX.


Remove sw-nginx on Centos 6.6 and other Problem, Changes with nginx 1.6.2 16 Sep 2014 *) Security: it was possible to reuse SSL sessions in unrelated contexts Bugfix: nginx could not be built on Linux with x32 ABI. Feature: resolver now randomly rotates addresses returned from cache. Prebuilt Packages for Linux and BSD¶. Most Linux distributions and BSD variants have NGINX in the usual package repositories and they can be installed via whatever method is normally used to install software (apt-get on Debian, emerge on Gentoo, ports on FreeBSD, etc).