Nginx startup fails ssl no such file or directory

Are you sure that the Nginx user has access to the directory?

Also check the permissions of the .pem file, if Nginx cannot access it, it can show as 'no such file or directory'.

If the permissions are right, you might check the actual path again. How you pasted it (which I know you removed the dir) there is no beginning / which could be the problem.

EDIT

Try moving your SSL setup into the following structure (as well as change the nginx.conf to reflect):

sudo mkdir /etc/nginx/ssl
sudo chown -R root:root /etc/nginx/ssl
sudo chmod -R 600 /etc/nginx/ssl

Nginx could be failing on your .pem because the permissions are too open (need source to verify that Nginx does this) but the above setup should work fine.


I will leave my answer for my problem, in case someone come across this topic.

I have nginx run inside docker container, and have the same error trying to access the private key file. After scratching my head for several hours, I come to a realization that my docker's nginx does not have the mount volume that contains my data.

The only option to add mount volume is to remove and re-create the container with the -v option: https://docs.docker.com/engine/tutorials/dockervolumes/

docker run -d -P --name docker-nginx -v /etc/ssl/certs:/etc/ssl/certs nginx

Sometimes, trivial things are hard to see. Hope this help.