A
A
Alexander Goncharov2014-09-04 21:22:38
PHP
Alexander Goncharov, 2014-09-04 21:22:38

Why does nginx logs tell me (13: Permission denied) when executing php scripts?

Hey guys.
Tell me, where are my jambs in setting up nginx + pfp-fpm? In the server logs, I write the following error to a simple script that executes phpinfo ().

2014/09/04 22:06:10 [crit] 3944#0: *455 open() "/var/lib/nginx/tmp/fastcgi/7/04/0000000047" failed (13: Permission denied) while reading upstream, client: xx.xxx.xx.xx, server: xxx.xxx.xxx.xxx, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "xxx.xxx.xxx.xxx"

What configs to copy here so that you can help? Which user should have rights? What should be the rights? And where should this user be registered in the files?
Thank you very much
ps installed CentOS 6+

Answer the question

In order to leave comments, you need to log in

8 answer(s)
B
Blumfontein, 2014-09-05
@websanya

Let my_user be the user in whose directory the site is running.
1) In nginx.conf put
2) In php5/fpm/pool.d/www.conf

# Найдите и исправьте на
user = my_user
group = my_user
listen.owner = my_user
listen.group = my_user

3) Restart nginx and fpm. Next, on the /var/lib/nginx/tmp folder, manually set the rights 0700 to the user my_user
4) PROFIT

M
Mexof, 2014-09-05
@Mexof

Look in /etc/nginx/nginx.conf (maybe a different path in CentOS, I don't know) the line "user nginx;", it should be called that. It should be changed to user www-data; And give rights to the www-data group on your site:
chown -R user:www-data /path/site - where user is your username, /path/site is the path to the site.

M
Maksim Zverev, 2014-09-04
@m1skam

See what user nginx is running as and see what permissions are on /var/lib/nginx/tmp/

R
Ridorix, 2018-08-21
@ridorix

Can help someone - SELinux can block.
Either set it up or disable it.

S
s1dney, 2014-09-04
@s1dney

The user who makes php needs rights to these files. (of course, the directory must also have rights)

I
Igor, 2014-09-04
@merryjane

php-fpm and nginx should work for you as a single user. And this user must have rights to the above file. You can make a group where to add all these users and give it rights to this file, or rather the entire directory.

O
Official account of the Timeweb team, 2020-06-01
@timeweb_team

The issue was discussed here:
https://www.linux.org.ru/forum/admin/12879857

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question