server { listen 80; listen [::]:80; #domain name server_name drupal8.dev; #file document root. This has to match one of the volumes in docer-composer.yml root /var/www/drupal8; # This is the full path to your index file index index.php index.html index.htm; ## serve imagecache files directly or redirect to drupal if they do not exist. location ~* files/styles { access_log off; expires 30d; try_files $uri @drupal; } ## serve imagecache files directly or redirect to drupal if they do not exist. location ~* ^.+.(xsl|xml)$ { access_log off; expires 1d; try_files $uri @drupal; } ## Images and static content is treated different location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ { access_log off; expires 30d; } location / { index index.php; # This is cool because no php is touched for static content try_files $uri $uri/ @rewrite; expires max; } location @drupal { rewrite ^/(.*)$ /index.php?q=$1 last; } location @rewrite { # Some modules enforce no slash (/) at the end of the URL # Else this rewrite block wouldn't be needed (GlobalRedirect) rewrite ^/(.*)$ /index.php?q=$1; } location ~ .php$ { fastcgi_pass php-upstream; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }