Get the default configuration file fastcgi-php.conf for nginx, optimized for Ubuntu 18.04 LTS (Bionic Beaver). 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;
Download the raw file with wget or curl
wget -O fastcgi-php.conf.example https://exampleconfig.com/static/raw/nginx/ubuntu18.04/etc/nginx/snippets/fastcgi-php.conf
curl https://exampleconfig.com/static/raw/nginx/ubuntu18.04/etc/nginx/snippets/fastcgi-php.conf > fastcgi-php.conf.example
Other config files you might find useful