The URL example.org/index.php (and any example.org/etc.php) fail, but example.org/foo working fine, for any foo folder.
server {
server_name example.org example.com;
access_log /var/log/nginx/example.org.access_log;
root /var/www/example.org/;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ =403;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
}
- nginx version:
1.17.10(Ubuntu) - ?
/var/log/nginx/error.log(no specific for the server?)
sudo tail /var/log/nginx/error.log show nothing, only errors of other site,
...
2020/06/19 12:58:02 [error] 871296#871296: *23 "/var/www/example2.org/index2.php" is not found (2: No such file or directory), client: 181.177.112.xx, server: example2.org, request: "GET / HTTP/1.0", host: "example2.org"
MAIN CLUES TO THE SOLUTION (see my answer)
The file /run/php/php7.0-fpm.sock not exists, so the fail is at fastcgi_pass unix:/run/php/php7.0-fpm.sock;.
ls -l /run/php/*.sock shows
lrwxrwxrwx 1 root root 30 May 17 05:18 /run/php/php-fpm.sock -> /etc/alternatives/php-fpm.sock
srw-rw---- 1 www-data www-data 0 May 29 06:40 /run/php/php7.4-fpm.sock
Ideal is a generic socket, that is php-fpm.sock, but it is not seems the same (not redirect to php7.4-fpm.sock?).