-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx_host.conf
68 lines (53 loc) · 1.29 KB
/
nginx_host.conf
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
server {
server_name example.com;
root /var/www/example;
index index.php;
error_log /var/www/log/example_error.log;
location ~ \..*/.*\.php$ {
return 403;
}
# Block access to hidden directories
location ~ (^|/)\. {
return 403;
}
location ~ ^/sites/.*/private/ {
return 403;
}
# No php is touched for static content
location / {
try_files $uri /index.php?$query_string;
}
location ~* ^(?:.+\.(?:htaccess|make|txt|log|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(?:\.php)?|xtmpl)|code-style\.pl)$ {
return 404;
}
# pass the PHP scripts to FastCGI server
location ~ \.php$|^/update.php {
fastcgi_index index.php;
try_files $uri =404;
fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# Clean URLs
location @rewrite {
rewrite ^ /index.php;
}
# Image styles
location ~ ^/sites/.*/files/styles/ {
try_files $uri @rewrite;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
}