Problems with Nginx
#1
Hello. I've been having some problems setting up Nginx with php. In default.conf, I've included index.php in the index directive, enabled Nginx php support in the default.conf, restarted both Nginx and php-fpm services many times, and fastcgi_pass matches www.conf. Here's the default.conf file:

server {
listen 80;
server_name localhost;

location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

}

I think that fastcgi_split_path_info may be the problem. I get a "File Not Found." error and a "404 Forbidden" error when I change the fastcgi_split_path_info information. I also sometimes get a "FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream" error depending on what I change fastcgi_split_path_info to. Fastcgi_split_path_info is something I don't really understand. If possible, can someone please explain to me fastcgi_split_path_info? Also, any mistakes anyone notices or any sort of advice would be much appreciated.
Reply