Last active
November 26, 2017 20:34
-
-
Save colorfield/d58b7201fe83c5ed833f to your computer and use it in GitHub Desktop.
Drupal 8 Nginx virtual host
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
server_name drupal8.dev; # domain name, separate aliases by a space | |
root /path/to/site/drupal8-dev; # directory of the site (document root) | |
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 ~ (^|/)\. { | |
return 403; | |
} | |
location ~ ^/sites/.*/private/ { | |
access_log off; | |
deny all; | |
} | |
location / { | |
try_files $uri @rewrite; | |
} | |
location @rewrite { | |
rewrite ^ /index.php; | |
} | |
location ~ ^/(index|update)\.php(/|$) { | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_split_path_info ^(.+\.php)(/.*)$; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; | |
fastcgi_param DOCUMENT_ROOT $realpath_root; | |
fastcgi_intercept_errors on; | |
fastcgi_buffers 8 16k; | |
fastcgi_buffer_size 32k; | |
fastcgi_connect_timeout 300; | |
fastcgi_send_timeout 300; | |
fastcgi_read_timeout 300; | |
fastcgi_split_path_info ^(.+?\.php)(|/.*)$; | |
} | |
location ~ ^/sites/.*/files/imagecache/ { | |
try_files $uri @rewrite; | |
} | |
location ~ ^/sites/.*/files/styles/ { | |
try_files $uri @rewrite; | |
} | |
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { | |
expires max; | |
log_not_found off; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment