I'd like to get some answers or suggestions to my problem.
So I'm getting a simple error:
2014/02/16 12:01:43 [error] 7384#0: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,
server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm.sock:", host: "localhost"
Firstly, my nginx configuration is well done (for me - i.e. it is working well). The only problem I have is with linux permissions to files/folders. I can't understand a situation I'm in. Ok, so here is some info needed:
- my nginx works well, with PHP and mysql configured.
- a user used for nginx is named "nginx"
- index index.php index.html index.htm (nginx configuration for index directive)
Here is my problem:
I have a tree like: /home/user/
home dir is: root:root with 755
user dir is: user:user with 700
I created a file named index.php in /home/user/index.php. Nginx said (/var/log/nginx/error.log) that I have no permissions. Ok, I did "usermod -a nginx -G user" and changed permissions for "user" dir to: 750 (so now nginx belongs to user's group, and can read or execute contents of the user dir). Ok, this works but not in a 100% way. If I create now a file index.html, or index.htm - nginx works in a browser! wow! yeah.. now I want to create index.php, to write some code. Boom! The file was NOT FOUND. Hmmm, that's really interesting for me, what did I do wrong? The interesting fact is, if I change user dir permissions to: 755 (from 750), nginx sees index.php. If I understand correctly, nginx goes first through the "o" permissions into /home dir (r-x). Next it needs to go into "user" dir, and as nginx user is in user's group, so nginx can make a next step to use "g" permissions (user/ dir permissions) to come in. But what is making nginx can't see index.php (and sees index.html and .htm)?
Ok, maybe my knowledge has some bugs, but I need to ask, why does it happen?
No comments:
Post a Comment