Я создал сертификат на Ubuntu 16, и я пытаюсь запустить nginx и получить следующее:
$ nginx -t
nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1
nginx: [emerg] BIO_new_file("/etc/letsencrypt/live/my_website.com/fullchain.pem") failed (SSL: error:0200100D:system library:fopen:Permission denied:fopen('/etc/letsencrypt/live/my_website.com/fullchain.pem','r') error:2006D002:BIO routines:BIO_new_file:system lib)
nginx: configuration file /etc/nginx/nginx.conf test failed
Этот сертификат имеет стандартные разрешения lrwxrwxrwx 1 root root
. Но почему он недоступен для nginx? Конечно, я могу выполнить chmod 755
, но будет ли это правильным?
После перезапуска nginx работает, и мой веб-сайт тоже, но nginx -t
по-прежнему возвращает те же ошибки.
Похоже, вы используете nginx -t
как непривилегированный пользователь.
Чтобы проверить конфигурацию nginx, попробуйте:
$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
или, если sudo
недоступен:
$ su -
Password:
# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Он должен быть доступен через пользователя или группу nginx, например www-data. Это означает, что пользователь запустил nginx.
Попробуйте:
# setfacl -R -m u:www-data:rx /etc/letsencrypt/