-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvhost
70 lines (57 loc) · 2.43 KB
/
vhost
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Block access to "hidden" files and directories whose names begin with a
# period. This includes directories used by version control systems such
# as Subversion or Git to store control files.
location ~ (^|/)\. {
return 403;
}
location / {
# This is cool because no php is touched for static content
try_files $uri $uri @rewrite;
error_page 404 /index.php;
}
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;
}
# Don't allow direct access to PHP files in the vendor directory.
location ~ /vendor/.*\.php$ {
deny all;
return 404;
}
# In Drupal 8, we must also match new paths where the '.php' appears in the middle,
# such as update.php/selection. The rule we use is strict, and only allows this pattern
# with the update.php front controller. This allows legacy path aliases in the form of
# blog/index.php/legacy-path to continue to route to Drupal nodes. If you do not have
# any paths like that, then you might prefer to use a laxer rule, such as:
# location ~ \.php(/|$) {
# The laxer rule will continue to work if Drupal uses this new URL pattern with front
# controllers other than update.php in a future release.
location ~ '\.php$|^/update.php' {
try_files $uri =404;
fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_intercept_errors on;
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
}
## Drupal 7 generated image handling, i.e., imagecache in core. See:
## http://drupal.org/node/371374.
location ~* /files/styles/ {
## Image hotlinking protection. If you want hotlinking
## protection for your images uncomment the following line.
#include drupal/hotlinking_protection.conf;
access_log off;
expires 30d;
try_files $uri @rewrite;
}
#################
##Microcache drupal
#################
include /etc/nginx/microcache.conf;
add_header X-Cache-Status $upstream_cache_status;
#################
##Drupal config##
#################
include /etc/nginx/drupal/drupal.conf;