Nginx Default Config File for PHP-FPM

Last updated on

Here is the default Nginx config file with alterations to work with PHP-FPM. You can copy and paste this into your config file, you just need to change the line YOUR_DOMAIN_OR_IP_HERE to your own domain or IP address.

These are the changes made to the default Nginx configuration file to work with PHP-FPM.

  1. Add index.php to the index directive
  2. Add your domain name or IP address to the server_name directive
  3. Uncomment (remove the # symbols) from the location ~\.php$ location block
  4. Uncomment (remove the # symbols) from the location ~ /\.ht location block
  5. Make sure you have the correct PHP sock /run/php/php7.0-fpm.sock.  Run ls /run/php/ to find out which PHP version sock you have.

These changes are marked in red below.

1 Star2 Stars3 Stars4 Stars5 Stars 5.00 (1 votes)

Let me know if this helped. Follow me on Twitter, Facebook and YouTube, or 🍊 buy me a smoothie.

p.s. I increased my AdSense revenue by 68% using AI 🤖. Read my Ezoic review to find out how.

3 replies

newest oldest
Notify of
2 months ago

Hello support, My vps site BOT doesn’t work. Help me sir

Vuk Milicevic
Vuk Milicevic
Vuk Milicevic
3 months ago

snippets/fastcgi-php.conf is such a time saver!