Answer the question
In order to leave comments, you need to log in
CentOS + Nginx + PHP - permissions problem - what could be the reason?
I am deploying a project on symphony, on CentOS.
I get the classic first run error:
The stream or file "/var/www/site.loc/var/log/dev.log" could not be opened: failed to open stream: Permission denied
drwxr-xr-x. 6 nginx nginx 50 ноя 5 11:07 assets
drwxr-xr-x. 2 nginx nginx 36 ноя 5 11:07 bin
drwxr-xr-x. 3 nginx nginx 40 ноя 5 11:07 bundle
-rw-r--r--. 1 nginx nginx 402 ноя 5 11:07 codeception.yml
-rw-r--r--. 1 nginx nginx 3164 ноя 5 11:07 composer.json
-rw-r--r--. 1 nginx nginx 359496 ноя 5 11:07 composer.lock
drwxr-xr-x. 4 nginx nginx 116 ноя 5 11:07 config
drwxr-xr-x. 2 nginx nginx 32 ноя 5 11:07 docs
drwxr-xr-x. 7 nginx nginx 90 ноя 5 11:07 lib
drwxr-xr-x. 750 nginx nginx 24576 ноя 5 11:26 node_modules
-rw-r--r--. 1 nginx nginx 797 ноя 5 11:07 package.json
-rw-r--r--. 1 nginx nginx 1026 ноя 5 11:07 phpunit.xml.dist
drwxrwxrwx. 5 nginx nginx 163 ноя 5 13:08 public
drwxr-xr-x. 12 nginx nginx 190 ноя 5 11:07 src
-rw-r--r--. 1 nginx nginx 18130 ноя 5 11:07 symfony.lock
drwxr-xr-x. 6 nginx nginx 93 ноя 5 11:07 templates
drwxr-xr-x. 9 nginx nginx 214 ноя 5 11:07 tests
drwxr-xr-x. 2 nginx nginx 24 ноя 5 11:07 translations
drwxrwxrwx. 4 nginx nginx 30 ноя 5 11:09 var
drwxr-xr-x. 39 nginx nginx 4096 ноя 5 11:09 vendor
-rw-r--r--. 1 nginx nginx 2644 ноя 5 11:07 webpack.config.js
-rw-r--r--. 1 nginx nginx 234509 ноя 5 11:21 yarn-error.log
-rw-r--r--. 1 nginx nginx 301130 ноя 5 11:24 yarn.lock
Answer the question
In order to leave comments, you need to log in
Why chop off the shoulder and turn it off?
The problem lies in SELinuxe and its useful security policy.
In short, you need to add the necessary context to the directory so that Nginx can write logs there - httpd_log_t. I wrote more about
the
solution
at i.valman.org/2020/10/nginx-centos-selinux.html words and one comment do not lay down the whole meaning of the actions.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question