How to do it...

This recipe is for a basic Drupal configuration, with the Drupal files located in /var/www/html.

Here's the configuration to use:

server { 
    listen       80; 
    server_name  drupal.nginxcookbook.com; 
 
    access_log  /var/log/nginx/drupal.access.log  combined; 
    index index.php; 
 
    root   /var/www/html/; 
 
    location / { 
        try_files $uri $uri/ /index.php?$args; 
    } 
 
    location ~ (^|/)\. { 
        return 403; 
    } 
 
    location ~ /vendor/.*\.php$ { 
        deny all; 
        return 404; 
    } 
 
    location ~ \.php$|^/update.php { 
        fastcgi_pass unix:/var/run/php7.0-fpm.sock; 
        fastcgi_split_path_info ^(.+?\.php)(|/.*)$; 
        fastcgi_index index.php; 
        fastcgi_param SCRIPT_FILENAME 
$document_root$fastcgi_script_name; include fastcgi_params; } }