Eu olhei para outras respostas, mas ainda não consigo ver o problema com essas configurações:
user nginx;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
# Metadata cache
open_file_cache max=10000 inactive=5m;
open_file_cache_valid 2m;
open_file_cache_min_uses 1;
open_file_cache_errors on;
# Buffer
client_body_buffer_size 10K;
client_header_buffer_size 1k;
client_max_body_size 8m;
large_client_header_buffers 2 32k;
# Security Headers
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
server {
listen 80;
server_name example.com;
root /home/web/api;
index index.php;
location / {
try_files $uri /index.php;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:8999
location ~ [^/]\.php(/|$) {
include fastcgi_params;
fastcgi_pass unix:/var/run/php-fpm/example.com.socket;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_param HTTPS on;
}
#if ($http_x_forwarded_proto != "https") {
# return 301 https://$server_name$request_uri;
#}
location ~ /\.ht {
deny all;
}
}
}
e para php-fpm
[example.com]
listen = /var/run/php-fpm/example.com.socket
;listen = 127.0.0.1:9000
listen.backlog = -1
listen.owner = nginx
listen.group = www-data
listen.mode=0660
; Unix user/group of processes
user = nginx
group = www-data
chroot = /
; Choose how the process manager will control the number of child processes.
pm = dynamic
pm.max_children = 75
pm.start_servers = 10
pm.min_spare_servers = 5
pm.max_spare_servers = 20
pm.max_requests = 500
; Pass environment variables
env[HOSTNAME] = $HOSTNAME
Os arquivos existem na raiz para o servidor vh e são de propriedade do nginx com www-data como seu grupo.