Skip to content

Commit 1c3aaa0

Browse files
committed
Added Nginx's Drupal 8 templates
1 parent 81ae010 commit 1c3aaa0

File tree

26 files changed

+2483
-0
lines changed

26 files changed

+2483
-0
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
server {
2+
listen %ip%:%web_ssl_port%;
3+
server_name %domain_idn% %alias_idn%;
4+
root %docroot%;
5+
index index.php index.html index.htm;
6+
access_log /var/log/nginx/domains/%domain%.log combined;
7+
access_log /var/log/nginx/domains/%domain%.bytes bytes;
8+
error_log /var/log/nginx/domains/%domain%.error.log error;
9+
10+
ssl on;
11+
ssl_certificate %ssl_pem%;
12+
ssl_certificate_key %ssl_key%;
13+
14+
location = /favicon.ico {
15+
log_not_found off;
16+
access_log off;
17+
}
18+
19+
location = /robots.txt {
20+
allow all;
21+
log_not_found off;
22+
access_log off;
23+
}
24+
25+
location ~* \.(txt|log)$ {
26+
allow 192.168.0.0/16;
27+
deny all;
28+
}
29+
30+
location ~ \..*/.*\.php$ {
31+
return 403;
32+
}
33+
34+
# No no for private
35+
location ~ ^/sites/.*/private/ {
36+
return 403;
37+
}
38+
39+
# Block access to "hidden" files and directories whose names begin with a
40+
# period. This includes directories used by version control systems such
41+
# as Subversion or Git to store control files.
42+
location ~ (^|/)\. {
43+
return 403;
44+
}
45+
46+
location / {
47+
try_files $uri @rewrite;
48+
49+
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
50+
expires max;
51+
}
52+
53+
location ~ [^/]\.php(/|$)|^/update.php {
54+
fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
55+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
56+
if (!-f $document_root$fastcgi_script_name) {
57+
return 404;
58+
}
59+
60+
fastcgi_pass %backend_lsnr%;
61+
fastcgi_index index.php;
62+
fastcgi_param SCRIPT_FILENAME $request_filename;
63+
fastcgi_intercept_errors on;
64+
include /etc/nginx/fastcgi_params;
65+
}
66+
}
67+
68+
location @rewrite {
69+
# You have 2 options here
70+
# For D7 and above:
71+
# Clean URLs are handled in drupal_environment_initialize().
72+
rewrite ^ /index.php;
73+
}
74+
75+
location ~ ^/sites/.*/files/styles/ {
76+
try_files $uri @rewrite;
77+
}
78+
79+
error_page 403 /error/404.html;
80+
error_page 404 /error/404.html;
81+
error_page 500 502 503 504 /error/50x.html;
82+
83+
location /error/ {
84+
alias %home%/%user%/web/%domain%/document_errors/;
85+
}
86+
87+
location ~* "/\.(htaccess|htpasswd)$" {
88+
deny all;
89+
return 404;
90+
}
91+
92+
include /etc/nginx/conf.d/phpmyadmin.inc*;
93+
include /etc/nginx/conf.d/phppgadmin.inc*;
94+
include /etc/nginx/conf.d/webmail.inc*;
95+
96+
include %home%/%user%/conf/web/nginx.%domain%.conf*;
97+
}
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
server {
2+
listen %ip%:%web_port%;
3+
server_name %domain_idn% %alias_idn%;
4+
root %docroot%;
5+
index index.php index.html index.htm;
6+
access_log /var/log/nginx/domains/%domain%.log combined;
7+
access_log /var/log/nginx/domains/%domain%.bytes bytes;
8+
error_log /var/log/nginx/domains/%domain%.error.log error;
9+
10+
location = /favicon.ico {
11+
log_not_found off;
12+
access_log off;
13+
}
14+
15+
location = /robots.txt {
16+
allow all;
17+
log_not_found off;
18+
access_log off;
19+
}
20+
21+
# Very rarely should these ever be accessed outside of your lan
22+
location ~* \.(txt|log)$ {
23+
allow 192.168.0.0/16;
24+
deny all;
25+
}
26+
27+
location ~ \..*/.*\.php$ {
28+
return 403;
29+
}
30+
31+
# No no for private
32+
location ~ ^/sites/.*/private/ {
33+
return 403;
34+
}
35+
36+
# Block access to "hidden" files and directories whose names begin with a
37+
# period. This includes directories used by version control systems such
38+
# as Subversion or Git to store control files.
39+
location ~ (^|/)\. {
40+
return 403;
41+
}
42+
43+
location / {
44+
try_files $uri @rewrite;
45+
46+
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
47+
expires max;
48+
}
49+
50+
location ~ [^/]\.php(/|$)|^/update.php {
51+
fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
52+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
53+
if (!-f $document_root$fastcgi_script_name) {
54+
return 404;
55+
}
56+
57+
fastcgi_pass %backend_lsnr%;
58+
fastcgi_index index.php;
59+
fastcgi_param SCRIPT_FILENAME $request_filename;
60+
fastcgi_intercept_errors on;
61+
include /etc/nginx/fastcgi_params;
62+
}
63+
}
64+
65+
location @rewrite {
66+
# You have 2 options here
67+
# For D7 and above:
68+
# Clean URLs are handled in drupal_environment_initialize().
69+
rewrite ^ /index.php;
70+
}
71+
72+
location ~ ^/sites/.*/files/styles/ {
73+
try_files $uri @rewrite;
74+
}
75+
76+
error_page 403 /error/404.html;
77+
error_page 404 /error/404.html;
78+
error_page 500 502 503 504 /error/50x.html;
79+
80+
location /error/ {
81+
alias %home%/%user%/web/%domain%/document_errors/;
82+
}
83+
84+
location ~* "/\.(htaccess|htpasswd)$" {
85+
deny all;
86+
return 404;
87+
}
88+
89+
include /etc/nginx/conf.d/phpmyadmin.inc*;
90+
include /etc/nginx/conf.d/phppgadmin.inc*;
91+
include /etc/nginx/conf.d/webmail.inc*;
92+
93+
include %home%/%user%/conf/web/nginx.%domain%.conf*;
94+
}
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
server {
2+
listen %ip%:%web_ssl_port%;
3+
server_name %domain_idn% %alias_idn%;
4+
root %docroot%;
5+
index index.php index.html index.htm;
6+
access_log /var/log/nginx/domains/%domain%.log combined;
7+
access_log /var/log/nginx/domains/%domain%.bytes bytes;
8+
error_log /var/log/nginx/domains/%domain%.error.log error;
9+
10+
ssl on;
11+
ssl_certificate %ssl_pem%;
12+
ssl_certificate_key %ssl_key%;
13+
14+
location = /favicon.ico {
15+
log_not_found off;
16+
access_log off;
17+
}
18+
19+
location = /robots.txt {
20+
allow all;
21+
log_not_found off;
22+
access_log off;
23+
}
24+
25+
location ~* \.(txt|log)$ {
26+
allow 192.168.0.0/16;
27+
deny all;
28+
}
29+
30+
location ~ \..*/.*\.php$ {
31+
return 403;
32+
}
33+
34+
# No no for private
35+
location ~ ^/sites/.*/private/ {
36+
return 403;
37+
}
38+
39+
# Block access to "hidden" files and directories whose names begin with a
40+
# period. This includes directories used by version control systems such
41+
# as Subversion or Git to store control files.
42+
location ~ (^|/)\. {
43+
return 403;
44+
}
45+
46+
location / {
47+
try_files $uri @rewrite;
48+
49+
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
50+
expires max;
51+
}
52+
53+
location ~ [^/]\.php(/|$)|^/update.php {
54+
fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
55+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
56+
if (!-f $document_root$fastcgi_script_name) {
57+
return 404;
58+
}
59+
60+
fastcgi_pass %backend_lsnr%;
61+
fastcgi_index index.php;
62+
fastcgi_param SCRIPT_FILENAME $request_filename;
63+
fastcgi_intercept_errors on;
64+
include /etc/nginx/fastcgi_params;
65+
}
66+
}
67+
68+
location @rewrite {
69+
# You have 2 options here
70+
# For D7 and above:
71+
# Clean URLs are handled in drupal_environment_initialize().
72+
rewrite ^ /index.php;
73+
}
74+
75+
location ~ ^/sites/.*/files/styles/ {
76+
try_files $uri @rewrite;
77+
}
78+
79+
error_page 403 /error/404.html;
80+
error_page 404 /error/404.html;
81+
error_page 500 502 503 504 /error/50x.html;
82+
83+
location /error/ {
84+
alias %home%/%user%/web/%domain%/document_errors/;
85+
}
86+
87+
location ~* "/\.(htaccess|htpasswd)$" {
88+
deny all;
89+
return 404;
90+
}
91+
92+
include /etc/nginx/conf.d/phpmyadmin.inc*;
93+
include /etc/nginx/conf.d/phppgadmin.inc*;
94+
include /etc/nginx/conf.d/webmail.inc*;
95+
96+
include %home%/%user%/conf/web/nginx.%domain%.conf*;
97+
}
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
server {
2+
listen %ip%:%web_port%;
3+
server_name %domain_idn% %alias_idn%;
4+
root %docroot%;
5+
index index.php index.html index.htm;
6+
access_log /var/log/nginx/domains/%domain%.log combined;
7+
access_log /var/log/nginx/domains/%domain%.bytes bytes;
8+
error_log /var/log/nginx/domains/%domain%.error.log error;
9+
10+
location = /favicon.ico {
11+
log_not_found off;
12+
access_log off;
13+
}
14+
15+
location = /robots.txt {
16+
allow all;
17+
log_not_found off;
18+
access_log off;
19+
}
20+
21+
# Very rarely should these ever be accessed outside of your lan
22+
location ~* \.(txt|log)$ {
23+
allow 192.168.0.0/16;
24+
deny all;
25+
}
26+
27+
location ~ \..*/.*\.php$ {
28+
return 403;
29+
}
30+
31+
# No no for private
32+
location ~ ^/sites/.*/private/ {
33+
return 403;
34+
}
35+
36+
# Block access to "hidden" files and directories whose names begin with a
37+
# period. This includes directories used by version control systems such
38+
# as Subversion or Git to store control files.
39+
location ~ (^|/)\. {
40+
return 403;
41+
}
42+
43+
location / {
44+
try_files $uri @rewrite;
45+
46+
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
47+
expires max;
48+
}
49+
50+
location ~ [^/]\.php(/|$)|^/update.php {
51+
fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
52+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
53+
if (!-f $document_root$fastcgi_script_name) {
54+
return 404;
55+
}
56+
57+
fastcgi_pass %backend_lsnr%;
58+
fastcgi_index index.php;
59+
fastcgi_param SCRIPT_FILENAME $request_filename;
60+
fastcgi_intercept_errors on;
61+
include /etc/nginx/fastcgi_params;
62+
}
63+
}
64+
65+
location @rewrite {
66+
# You have 2 options here
67+
# For D7 and above:
68+
# Clean URLs are handled in drupal_environment_initialize().
69+
rewrite ^ /index.php;
70+
}
71+
72+
location ~ ^/sites/.*/files/styles/ {
73+
try_files $uri @rewrite;
74+
}
75+
76+
error_page 403 /error/404.html;
77+
error_page 404 /error/404.html;
78+
error_page 500 502 503 504 /error/50x.html;
79+
80+
location /error/ {
81+
alias %home%/%user%/web/%domain%/document_errors/;
82+
}
83+
84+
location ~* "/\.(htaccess|htpasswd)$" {
85+
deny all;
86+
return 404;
87+
}
88+
89+
include /etc/nginx/conf.d/phpmyadmin.inc*;
90+
include /etc/nginx/conf.d/phppgadmin.inc*;
91+
include /etc/nginx/conf.d/webmail.inc*;
92+
93+
include %home%/%user%/conf/web/nginx.%domain%.conf*;
94+
}

0 commit comments

Comments
 (0)