Drupal NGINX

NGINX default configuration file for Drupal 8

After a couple of hours struggle with Nginx default file to run Drupal 8 production website, we found the solutions for the following problems.

  • Image style is not generating in Drupal 8 with Nginx.
  • Images are not loading with different image styles like thumbnail, medium, etc
  • access denied for the images in Drupal 8 with Nginx
  • access denied /sites/default/files/styles/thumbnail/public/pictures/  Drupal 8 nginx 

Using following default file, we are able to solve all problems addressed above.

And also added couple of tips for following questions,

How to make access rss.xml in Drupal 8 with Nginx?

      # RSS Feed.
      location = /rss.xml {
        rewrite ^ /index.php?q=rss.xml;

How to make access sitemap.xml in Drupal 8 with Nginx?

      # Sitemap Feed.
      location = /sitemap.xml {
        try_files $uri /index.php?q=sitemap.xml;