I read several entries on why PHP-FPM might give me permission denied but I can not solve it.
The error logs read like:
2013/04/20 23:33:28 [crit] 15479#0: *6 open() "/var/lib/nginx/tmp/fastcgi /2/00/0000000002" failed (13: Permission denied) while reading upstream, client: 99.999.999.999, server: example.net, request: "GET /wp-admin/ HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-fpm.sock:", host: "example.net", referrer: "http://example.net/" Im a little but lost:
- I have set the /var/lib/nginx/tmp to ec2-user (i even +777 everything to check)
- I have set the /tmp/php-fpm.sock to ec2-user
- the nginx conf file is set to ec2-user
- the php-conf is set to user and group ec2-user
- ps aux gives ec2-user on all php-fpm and nginx processes
My Nginx Configuration includes a lot of files , the basic conf is:
user ec2-user ec2-user; worker_processes 5; error_log /opt/nginx/error.log; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /opt/nginx/access.log main; sendfile on; keepalive_timeout 65; client_max_body_size 13m; index index.php index.html index.htm; upstream php { server unix:/tmp/php-fpm.sock; } include /etc/nginx/conf.d/*.conf; include /mnt/web/nginx/conf.d/*.conf; } my /etc/nginx/conf.d/ is empty my /mnt/web/nginx/conf.d contain A LOT of website configurations which all include "wordpress.conf":
location / { try_files $uri $uri/ /index.php?$args; } rewrite /wp-admin$ $scheme://$host$uri/ permanent; location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { expires 24h; log_not_found off; } location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; include fastcgi_params; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass php; } My /opt/php/etc/php-fpm.conf:
include=/opt/php/etc/fpm.d/*.conf pid = run/php-fpm.pid error_log = log/php-fpm.log log_level = notice [www] listen = /tmp/php-fpm.sock user = ec2-user group = ec2-user pm = dynamic pm.max_children = 250 pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500 pm.status_path = /fpm-status ping.path = /fpm-ping slowlog = log/$pool.log.slow catch_workers_output = yes UPDATE: found the problem, put it in the answer