Skip to content

Instantly share code, notes, and snippets.

@Codenator81
Last active January 11, 2016 19:12
Show Gist options
  • Save Codenator81/1703f0c6a7db8503e056 to your computer and use it in GitHub Desktop.
Save Codenator81/1703f0c6a7db8503e056 to your computer and use it in GitHub Desktop.
Drupal 8 NGINX
# Codenator Drupal 8 developer http://codenator.org
server {
listen 80;
server_name drupal.local;
root /home/alex/nginx/www/drupal.local/public_html;
access_log /home/alex/nginx/www/drupal.local.access.log;
error_log /home/alex/nginx/www/drupal.local.error.log info;
index index.php;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ \..*/.*\.php {
return 403;
}
location / {
# This is cool because no php is touched for static content
try_files $uri $uri/ @rewrite;
expires max;
}
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$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment