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

Original 📋 Ubuntu 18.04 LTS (Bionic Beaver) 13 lines

Details

Size
13 lines
MD5
678c2236edfebe41de06c26fb378e9a0
SHA256
973ee254513b609fd9ec80572befa147d841a6fed622bdd5656037811f15bc5d
/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/678c2236edfebe41de06c26fb378e9a0?hint=fastcgi-php.conf
wget:
wget -O fastcgi-php.conf https://exampleconfig.com/api/v1/config/original/678c2236edfebe41de06c26fb378e9a0?hint=fastcgi-php.conf

For AI Agents

<prompt><role>DevOps agent</role><source url='https://exampleconfig.com/api/v1/config/original/678c2236edfebe41de06c26fb378e9a0?hint=fastcgi-php.conf' /><config><app>NGINX</app><os>Ubuntu 18.04 LTS (Bionic Beaver)</os><location>/etc/nginx/snippets/fastcgi-php.conf</location><lines>13</lines><md5>678c2236edfebe41de06c26fb378e9a0</md5><sha256>973ee254513b609fd9ec80572befa147d841a6fed622bdd5656037811f15bc5d</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 Ubuntu 18.04 LTS (Bionic Beaver). 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 Ubuntu 18.04 LTS (Bionic Beaver).

Can I use this for NGINX troubleshooting?

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