Skip to content

Commit 444ffad

Browse files
committed
Add grav templates for nginx
1 parent 4b1b836 commit 444ffad

File tree

2 files changed

+120
-0
lines changed

2 files changed

+120
-0
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#=======================================================================#
2+
# Default Web Domain Template #
3+
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
4+
#=======================================================================#
5+
6+
server {
7+
listen %ip%:%web_ssl_port% ssl http2;
8+
server_name %domain_idn% %alias_idn%;
9+
root %sdocroot%;
10+
index index.php index.html index.htm;
11+
access_log /var/log/nginx/domains/%domain%.log combined;
12+
access_log /var/log/nginx/domains/%domain%.bytes bytes;
13+
error_log /var/log/nginx/domains/%domain%.error.log error;
14+
15+
ssl_certificate %ssl_pem%;
16+
ssl_certificate_key %ssl_key%;
17+
ssl_stapling on;
18+
ssl_stapling_verify on;
19+
20+
include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;
21+
22+
location / {
23+
try_files $uri $uri/ /index.php?$query_string;
24+
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
25+
expires max;
26+
fastcgi_hide_header "Set-Cookie";
27+
}
28+
29+
location ~ [^/]\.php(/|$) {
30+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
31+
if (!-f $document_root$fastcgi_script_name) {
32+
return 404;
33+
}
34+
35+
fastcgi_pass %backend_lsnr%;
36+
fastcgi_index index.php;
37+
include /etc/nginx/fastcgi_params;
38+
}
39+
}
40+
41+
location /error/ {
42+
alias %home%/%user%/web/%domain%/document_errors/;
43+
}
44+
45+
location ~* /(\.git|cache|bin|logs|backup|tests)/.*$ { return 403; }
46+
location ~* /(system|vendor)/.*\.(txt|xml|md|html|yaml|yml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
47+
location ~* /user/.*\.(txt|md|yaml|yml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
48+
location ~ /(LICENSE\.txt|composer\.lock|composer\.json|nginx\.conf|web\.config|htaccess\.txt|\.htaccess) { return 403; }
49+
50+
location ~ /\.(?!well-known\/) {
51+
deny all;
52+
return 404;
53+
}
54+
55+
location /vstats/ {
56+
alias %home%/%user%/web/%domain%/stats/;
57+
include %home%/%user%/web/%domain%/stats/auth.conf*;
58+
}
59+
60+
include /etc/nginx/conf.d/phpmyadmin.inc*;
61+
include /etc/nginx/conf.d/phppgadmin.inc*;
62+
include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
63+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#=======================================================================#
2+
# Default Web Domain Template #
3+
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
4+
#=======================================================================#
5+
6+
server {
7+
listen %ip%:%web_port%;
8+
server_name %domain_idn% %alias_idn%;
9+
root %docroot%;
10+
index index.php index.html index.htm;
11+
access_log /var/log/nginx/domains/%domain%.log combined;
12+
access_log /var/log/nginx/domains/%domain%.bytes bytes;
13+
error_log /var/log/nginx/domains/%domain%.error.log error;
14+
15+
include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;
16+
17+
location / {
18+
try_files $uri $uri/ /index.php?$query_string;
19+
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
20+
expires max;
21+
fastcgi_hide_header "Set-Cookie";
22+
}
23+
24+
location ~ [^/]\.php(/|$) {
25+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
26+
if (!-f $document_root$fastcgi_script_name) {
27+
return 404;
28+
}
29+
30+
fastcgi_pass %backend_lsnr%;
31+
fastcgi_index index.php;
32+
include /etc/nginx/fastcgi_params;
33+
}
34+
}
35+
location /error/ {
36+
alias %home%/%user%/web/%domain%/document_errors/;
37+
}
38+
39+
location ~* /(\.git|cache|bin|logs|backup|tests)/.*$ { return 403; }
40+
location ~* /(system|vendor)/.*\.(txt|xml|md|html|yaml|yml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
41+
location ~* /user/.*\.(txt|md|yaml|yml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
42+
location ~ /(LICENSE\.txt|composer\.lock|composer\.json|nginx\.conf|web\.config|htaccess\.txt|\.htaccess) { return 403; }
43+
44+
location ~ /\.(?!well-known\/) {
45+
deny all;
46+
return 404;
47+
}
48+
49+
location /vstats/ {
50+
alias %home%/%user%/web/%domain%/stats/;
51+
include %home%/%user%/web/%domain%/stats/auth.conf*;
52+
}
53+
54+
include /etc/nginx/conf.d/phpmyadmin.inc*;
55+
include /etc/nginx/conf.d/phppgadmin.inc*;
56+
include %home%/%user%/conf/web/%domain%/nginx.conf_*;
57+
}

0 commit comments

Comments
 (0)