nginx fastcgi-php.conf configuration example for Ubuntu 16.04 LTS (Xenial Xerus)

Get the default configuration file fastcgi-php.conf for nginx, optimized for Ubuntu 16.04 LTS (Xenial Xerus). 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 16.04 LTS (Xenial Xerus)
Length
13 lines
MD5 checksum
678c2236edfebe41de06c26fb378e9a0

Usage

Download the raw file with wget or curl

Wget

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

cURL

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