NGINX /etc/nginx/snippets/fastcgi-php.conf

Original 📋 Debian 13 (Trixie) 13 lines

Works On

Viewing:
Debian 13 (Trixie)
Same on:
Debian 10 (Buster) Debian 11 (Bullseye) Debian 12 (Bookworm) Ubuntu 20.04 LTS (Focal Fossa) Ubuntu 22.04 LTS (Jammy Jellyfish) Ubuntu 24.04 LTS (Noble Numbat)
Other versions:

Details

Size
13 lines
MD5
828e5bd1f3de7b3ef0e6856598b2a8c0
SHA256
a9dd98bf9631d727f0a846a9c7f4fe6193468a714c782df26d5cc9a7756411f2
/etc/nginx/snippets/fastcgi-php.conf
# regex to split $uri to $fastcgi_script_name and $fastcgi_path
fastcgi_split_path_info ^(.+?\.php)(/.*)$;

# Check that the PHP script exists before passing it
try_files $fastcgi_script_name =404;

# Bypass the fact that try_files resets $fastcgi_path_info
# see: http://trac.nginx.org/nginx/ticket/321
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;

fastcgi_index index.php;
include fastcgi.conf;

Copy & Paste

curl:
curl https://exampleconfig.com/api/v1/config/original/828e5bd1f3de7b3ef0e6856598b2a8c0?hint=fastcgi-php.conf
wget:
wget -O fastcgi-php.conf https://exampleconfig.com/api/v1/config/original/828e5bd1f3de7b3ef0e6856598b2a8c0?hint=fastcgi-php.conf

For AI Agents

<prompt><role>DevOps agent</role><source url='https://exampleconfig.com/api/v1/config/original/828e5bd1f3de7b3ef0e6856598b2a8c0?hint=fastcgi-php.conf' /><config><app>NGINX</app><os>Debian 13 (Trixie)</os><location>/etc/nginx/snippets/fastcgi-php.conf</location><lines>13</lines><md5>828e5bd1f3de7b3ef0e6856598b2a8c0</md5><sha256>a9dd98bf9631d727f0a846a9c7f4fe6193468a714c782df26d5cc9a7756411f2</sha256></config></prompt>

Paste into Claude, ChatGPT, or any AI assistant.

Install NGINX

Alpine Linux

sudo apk add nginx

Debian

sudo apt update && sudo apt install nginx

Red Hat Enterprise Linux

sudo yum install nginx

Ubuntu

sudo apt update && sudo apt install nginx

File Location

File Path
/etc/nginx/snippets/fastcgi-php.conf
Directory
/etc/nginx/snippets/
Significance
System-wide configuration directory
Description
Files in /etc/ contain system-wide configuration settings that affect all users.

FAQ

When should I use this fastcgi-php.conf?

Use it to restore a missing default, confirm what shipped, or diff against your current NGINX config.

How do I restore NGINX defaults?

Download the file, back up the current one in /etc/nginx/snippets/fastcgi-php.conf, replace it, then reload or restart NGINX.

Is fastcgi-php.conf safe for production?

It is the vendor default for Debian 13 (Trixie). Treat it as a baseline and review security and performance settings before production use.

How does this differ from other OS versions?

Defaults vary by distro and version. This copy matches Debian 13 (Trixie).

Can I use this for NGINX troubleshooting?

Yes. Diff it against yours to find drift, then restore only the sections you need.