Skip to content

Commit 6de8aaa

Browse files
committed
Added Nginx's Moodle templates
1 parent 9755437 commit 6de8aaa

File tree

26 files changed

+2171
-0
lines changed

26 files changed

+2171
-0
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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+
rewrite ^/(.*\.php)(/)(.*)$ /$1?file=/$3 last;
15+
16+
location = /favicon.ico {
17+
log_not_found off;
18+
access_log off;
19+
}
20+
21+
location = /robots.txt {
22+
allow all;
23+
log_not_found off;
24+
access_log off;
25+
}
26+
27+
location ~* \.(txt|log)$ {
28+
allow 192.168.0.0/16;
29+
deny all;
30+
}
31+
32+
location ~ \..*/.*\.php$ {
33+
return 403;
34+
}
35+
36+
# No no for private
37+
location ~ ^/sites/.*/private/ {
38+
return 403;
39+
}
40+
41+
# Block access to "hidden" files and directories whose names begin with a
42+
# period. This includes directories used by version control systems such
43+
# as Subversion or Git to store control files.
44+
location ~ (^|/)\. {
45+
return 403;
46+
}
47+
48+
location / {
49+
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
50+
expires max;
51+
}
52+
53+
location ~ [^/]\.php(/|$) {
54+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
55+
if (!-f $document_root$fastcgi_script_name) {
56+
return 404;
57+
}
58+
59+
fastcgi_pass %backend_lsnr%;
60+
fastcgi_index index.php;
61+
fastcgi_param SCRIPT_FILENAME $request_filename;
62+
fastcgi_intercept_errors on;
63+
include /etc/nginx/fastcgi_params;
64+
}
65+
}
66+
67+
error_page 403 /error/404.html;
68+
error_page 404 /error/404.html;
69+
error_page 500 502 503 504 /error/50x.html;
70+
71+
location /error/ {
72+
alias %home%/%user%/web/%domain%/document_errors/;
73+
}
74+
75+
location ~* "/\.(htaccess|htpasswd)$" {
76+
deny all;
77+
return 404;
78+
}
79+
80+
include /etc/nginx/conf.d/phpmyadmin.inc*;
81+
include /etc/nginx/conf.d/phppgadmin.inc*;
82+
include /etc/nginx/conf.d/webmail.inc*;
83+
84+
include %home%/%user%/conf/web/nginx.%domain%.conf*;
85+
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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+
rewrite ^/(.*\.php)(/)(.*)$ /$1?file=/$3 last;
11+
12+
location = /favicon.ico {
13+
log_not_found off;
14+
access_log off;
15+
}
16+
17+
location = /robots.txt {
18+
allow all;
19+
log_not_found off;
20+
access_log off;
21+
}
22+
23+
# Very rarely should these ever be accessed outside of your lan
24+
location ~* \.(txt|log)$ {
25+
allow 192.168.0.0/16;
26+
deny all;
27+
}
28+
29+
location ~ \..*/.*\.php$ {
30+
return 403;
31+
}
32+
33+
# No no for private
34+
location ~ ^/sites/.*/private/ {
35+
return 403;
36+
}
37+
38+
# Block access to "hidden" files and directories whose names begin with a
39+
# period. This includes directories used by version control systems such
40+
# as Subversion or Git to store control files.
41+
location ~ (^|/)\. {
42+
return 403;
43+
}
44+
45+
location / {
46+
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
47+
expires max;
48+
}
49+
50+
location ~ [^/]\.php(/|$) {
51+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
52+
if (!-f $document_root$fastcgi_script_name) {
53+
return 404;
54+
}
55+
56+
fastcgi_pass %backend_lsnr%;
57+
fastcgi_index index.php;
58+
fastcgi_param SCRIPT_FILENAME $request_filename;
59+
fastcgi_intercept_errors on;
60+
include /etc/nginx/fastcgi_params;
61+
}
62+
}
63+
64+
error_page 403 /error/404.html;
65+
error_page 404 /error/404.html;
66+
error_page 500 502 503 504 /error/50x.html;
67+
68+
location /error/ {
69+
alias %home%/%user%/web/%domain%/document_errors/;
70+
}
71+
72+
location ~* "/\.(htaccess|htpasswd)$" {
73+
deny all;
74+
return 404;
75+
}
76+
77+
include /etc/nginx/conf.d/phpmyadmin.inc*;
78+
include /etc/nginx/conf.d/phppgadmin.inc*;
79+
include /etc/nginx/conf.d/webmail.inc*;
80+
81+
include %home%/%user%/conf/web/nginx.%domain%.conf*;
82+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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+
rewrite ^/(.*\.php)(/)(.*)$ /$1?file=/$3 last;
15+
16+
location = /favicon.ico {
17+
log_not_found off;
18+
access_log off;
19+
}
20+
21+
location = /robots.txt {
22+
allow all;
23+
log_not_found off;
24+
access_log off;
25+
}
26+
27+
location ~* \.(txt|log)$ {
28+
allow 192.168.0.0/16;
29+
deny all;
30+
}
31+
32+
location ~ \..*/.*\.php$ {
33+
return 403;
34+
}
35+
36+
# No no for private
37+
location ~ ^/sites/.*/private/ {
38+
return 403;
39+
}
40+
41+
# Block access to "hidden" files and directories whose names begin with a
42+
# period. This includes directories used by version control systems such
43+
# as Subversion or Git to store control files.
44+
location ~ (^|/)\. {
45+
return 403;
46+
}
47+
48+
location / {
49+
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
50+
expires max;
51+
}
52+
53+
location ~ [^/]\.php(/|$) {
54+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
55+
if (!-f $document_root$fastcgi_script_name) {
56+
return 404;
57+
}
58+
59+
fastcgi_pass %backend_lsnr%;
60+
fastcgi_index index.php;
61+
fastcgi_param SCRIPT_FILENAME $request_filename;
62+
fastcgi_intercept_errors on;
63+
include /etc/nginx/fastcgi_params;
64+
}
65+
}
66+
67+
error_page 403 /error/404.html;
68+
error_page 404 /error/404.html;
69+
error_page 500 502 503 504 /error/50x.html;
70+
71+
location /error/ {
72+
alias %home%/%user%/web/%domain%/document_errors/;
73+
}
74+
75+
location ~* "/\.(htaccess|htpasswd)$" {
76+
deny all;
77+
return 404;
78+
}
79+
80+
include /etc/nginx/conf.d/phpmyadmin.inc*;
81+
include /etc/nginx/conf.d/phppgadmin.inc*;
82+
include /etc/nginx/conf.d/webmail.inc*;
83+
84+
include %home%/%user%/conf/web/nginx.%domain%.conf*;
85+
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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+
rewrite ^/(.*\.php)(/)(.*)$ /$1?file=/$3 last;
11+
12+
location = /favicon.ico {
13+
log_not_found off;
14+
access_log off;
15+
}
16+
17+
location = /robots.txt {
18+
allow all;
19+
log_not_found off;
20+
access_log off;
21+
}
22+
23+
# Very rarely should these ever be accessed outside of your lan
24+
location ~* \.(txt|log)$ {
25+
allow 192.168.0.0/16;
26+
deny all;
27+
}
28+
29+
location ~ \..*/.*\.php$ {
30+
return 403;
31+
}
32+
33+
# No no for private
34+
location ~ ^/sites/.*/private/ {
35+
return 403;
36+
}
37+
38+
# Block access to "hidden" files and directories whose names begin with a
39+
# period. This includes directories used by version control systems such
40+
# as Subversion or Git to store control files.
41+
location ~ (^|/)\. {
42+
return 403;
43+
}
44+
45+
location / {
46+
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
47+
expires max;
48+
}
49+
50+
location ~ [^/]\.php(/|$) {
51+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
52+
if (!-f $document_root$fastcgi_script_name) {
53+
return 404;
54+
}
55+
56+
fastcgi_pass %backend_lsnr%;
57+
fastcgi_index index.php;
58+
fastcgi_param SCRIPT_FILENAME $request_filename;
59+
fastcgi_intercept_errors on;
60+
include /etc/nginx/fastcgi_params;
61+
}
62+
}
63+
64+
error_page 403 /error/404.html;
65+
error_page 404 /error/404.html;
66+
error_page 500 502 503 504 /error/50x.html;
67+
68+
location /error/ {
69+
alias %home%/%user%/web/%domain%/document_errors/;
70+
}
71+
72+
location ~* "/\.(htaccess|htpasswd)$" {
73+
deny all;
74+
return 404;
75+
}
76+
77+
include /etc/nginx/conf.d/phpmyadmin.inc*;
78+
include /etc/nginx/conf.d/phppgadmin.inc*;
79+
include /etc/nginx/conf.d/webmail.inc*;
80+
81+
include %home%/%user%/conf/web/nginx.%domain%.conf*;
82+
}

0 commit comments

Comments
 (0)