I have a CentOS 7 machine with Nginx running and the user is "nginx" (tghe default one in CentOS). I've installed Wordpress, which is working perfectly, and I've give wrtite permissions for nginx user in the wordpress folder and subfolders (775), but a still get a permission error:
Unable to create directory wp-content/uploads/2015/05
I double checked which user is running nginx worker processes and it is nginx.
It must be something trivial that I missed. Can someone help me?
EDIT:
I noticed this in /var/log/nginx/error.log:
2015/05/03 20:42:41 [error] 23652#0: *1 FastCGI sent in stderr: "Unable to open primary script: /usr/share/nginx/html/index.php (No such file or directory)" while reading response header from upstream, client: XXX.XXX.XXX.A, server: XXX.XXX.XXX.B, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm/php-fpm.sock:", host: "XXX.XXX.XXX.B"
2015/05/03 20:44:18 [error] 23652#0: *3 FastCGI sent in stderr: "Unable to open primary script: /usr/share/nginx/html/wp-admin/admin-ajax.php (No such file or directory)" while reading response header from upstream, client: XXX.XXX.XXX.A, server: XXX.XXX.XXX.B, request: "POST /wp-admin/admin-ajax.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm/php-fpm.sock:", host: "XXX.XXX.XXX.B", referrer: "http://XXX.XXX.XXX.B/wp-admin/"
2015/05/03 21:02:54 [emerg] 23803#0: getpwnam("http") failed in /etc/nginx/nginx.conf:6
EDIT 2
$ ps -elf|grep nginx
1 S root 2045 1 0 80 0 - 27393 sigsus 15:46 ? 00:00:00 nginx: master process /usr/sbin/nginx
5 S nginx 2049 2045 0 80 0 - 27503 ep_pol 15:46 ? 00:00:00 nginx: worker process
5 S nginx 2050 2045 0 80 0 - 27503 ep_pol 15:46 ? 00:00:00 nginx: worker process
5 S nginx 2051 2045 0 80 0 - 27503 ep_pol 15:46 ? 00:00:00 nginx: worker process
5 S nginx 2052 2045 0 80 0 - 27503 ep_pol 15:46 ? 00:00:00 nginx: worker process
The server configuration file is:
server {
listen 80;
server_name XXX.XXX.XXX.B;
location / {
root /var/www/wordpress;
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?q=$uri&$args;
}
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
root /var/www/wordpress;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
As for the nginx configuration file:
user nginx;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/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 /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
index index.html index.htm;
include /etc/nginx/conf.d/*.conf;
server {
listen 80 default_server;
server_name localhost;
root /usr/share/nginx/html;
include /etc/nginx/default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
}