nginx fastcgi-php.conf configuration example for Ubuntu 20.04 LTS (Focal Fossa)

Get the default configuration file fastcgi-php.conf for nginx, optimized for Ubuntu 20.04 LTS (Focal Fossa). This example configuration ensures optimal compatibility and performance for nginx, making it easy to set up and adjust to meet your needs.

Find and download the configuration file here: /etc/nginx/snippets/fastcgi-php.conf.

For more configurations and setup guides, visit our related files section to further customize your system.

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

    
  

Config Details

Location
/etc/nginx/snippets/fastcgi-php.conf
Operating system
Ubuntu 20.04 LTS (Focal Fossa)
Length
13 lines
MD5 checksum
828e5bd1f3de7b3ef0e6856598b2a8c0

Usage

Download the raw file with wget or curl

Wget

wget -O fastcgi-php.conf.example https://exampleconfig.com/static/raw/nginx/ubuntu20.04/etc/nginx/snippets/fastcgi-php.conf

cURL

curl https://exampleconfig.com/static/raw/nginx/ubuntu20.04/etc/nginx/snippets/fastcgi-php.conf > fastcgi-php.conf.example