server{
    :
    
    location / {
      # First attempt to serve request as file, then
      # as directory, then fall back to displaying a 404.
      try_files $uri $uri/ @extensionless-php;
    }

    location @extensionless-php {
      if ( -f $document_root$uri.php ) {
        rewrite ^ $uri.php last;
      }
      return 404;
    }
    
    :
}