Back to top

Add new comment

Update your Nginx config to support Drupal 8

If you are running Drupal 7 on Nginx, the good news is that your existing Nginx configuration is almost fully compatible with hosting Drupal 8. Except one thing: Drupal 8 Update module has been re-implemented, and your existing Nginx configuration will probably return 404. For more details on Drupal 8 Update module change, please see Move update.php back to a front controller.

The change matters to Nginx config is that Drupal 7 update.php URL is like

/update.php?op=info or /update.php?op=selection

while Drupal 8 update.php URL pattern is like

/update.php/selection or /update.php/result

So, what we need to change in the existing configuration is very simple. Look for your matching condition like

location ~ \.php$ {...}

then, change it to

location ~ \.php$|^/update.php {...}

This change is adding a new case to tell Nginx, if you run into update.php on the root level, just pass it to your upstream.

I have updated my Nginx template for running Drupal 7 and Drupal 8, you can see it https://gist.github.com/skyred/4248423 to look at the full picture.