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

Authentic ๐Ÿ“‹ Debian 9 (Stretch) 13 lines

File Info

Size
13 lines
MD5
678c2236edfebe41de06c26fb378e9a0
SHA256
973ee254513b609fd9ec80572befa147d841a6fed622bdd5656037811f15bc5d

Quick Commands

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
/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;

How to 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

Configuration 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.

Quick Answers

When should I use this fastcgi-php.conf?

Use this file to restore NGINX defaults after misconfiguration, for fresh installations, or as a customization baseline.

How do I restore NGINX defaults?

Download this file, backup your current config, then replace /etc/nginx/snippets/fastcgi-php.conf. Restart NGINX service.

Is fastcgi-php.conf safe for production?

Factory default from NGINX on Debian 9 (Stretch). Safe baseline, but customize for your requirements.

How does this differ from other OS versions?

This config is from Debian 9 (Stretch). Other OS versions may have different defaults. Check compatibility section.

Can I use this for NGINX troubleshooting?

Yes, compare this original config with your current settings to identify problematic modifications.