Skip to content

Commit 20d8b57

Browse files
Flarum support (hestiacp#3342)
* Flarum support * Run Prettier * update logo * Add nginx only templates --------- Co-authored-by: Stephen J Carnam <steveorevo@gmail.com> Co-authored-by: Steveorevo <steve@steveorevo.com>
1 parent 597908f commit 20d8b57

File tree

4 files changed

+442
-0
lines changed

4 files changed

+442
-0
lines changed
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
#=========================================================================#
2+
# Default Web Domain Template #
3+
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
4+
# https://docs.hestiacp.com/admin_docs/web.html#how-do-web-templates-work #
5+
#=========================================================================#
6+
7+
server {
8+
listen %ip%:%web_ssl_port% ssl http2;
9+
server_name %domain_idn% %alias_idn%;
10+
root %docroot%;
11+
index index.php index.html index.htm;
12+
access_log /var/log/nginx/domains/%domain%.log combined;
13+
access_log /var/log/nginx/domains/%domain%.bytes bytes;
14+
error_log /var/log/nginx/domains/%domain%.error.log error;
15+
16+
17+
include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;
18+
19+
# Pass requests that don't refer directly to files in the filesystem to index.php
20+
location / {
21+
try_files $uri $uri/ /index.php?$query_string;
22+
}
23+
24+
location ~ \.php$ {
25+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
26+
try_files $uri =404;
27+
fastcgi_pass %backend_lsnr%;
28+
fastcgi_index index.php;
29+
include /etc/nginx/fastcgi_params;
30+
include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
31+
}
32+
33+
#Uncomment the following lines if you are not using a `public` directory
34+
#to prevent sensitive resources from being exposed.
35+
location ~* ^/(\.git|composer\.(json|lock)|auth\.json|config\.php|flarum|storage|vendor) {
36+
deny all;
37+
return 404;
38+
}
39+
40+
# The following directives are based on best practices from H5BP Nginx Server Configs
41+
# https://github.com/h5bp/server-configs-nginx
42+
43+
# Expire rules for static content
44+
location ~* \.(?:manifest|appcache|html?|xml|json)$ {
45+
add_header Cache-Control "max-age=0";
46+
}
47+
48+
location ~* \.(?:rss|atom)$ {
49+
add_header Cache-Control "max-age=3600";
50+
}
51+
52+
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|mp4|ogg|ogv|webm|htc)$ {
53+
add_header Cache-Control "max-age=2592000";
54+
access_log off;
55+
}
56+
57+
location ~* \.(?:css|js)$ {
58+
add_header Cache-Control "max-age=31536000";
59+
access_log off;
60+
}
61+
62+
location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$ {
63+
add_header Cache-Control "max-age=2592000";
64+
access_log off;
65+
}
66+
67+
# Gzip compression
68+
gzip on;
69+
gzip_comp_level 5;
70+
gzip_min_length 256;
71+
gzip_proxied any;
72+
gzip_vary on;
73+
gzip_types
74+
application/atom+xml
75+
application/javascript
76+
application/json
77+
application/ld+json
78+
application/manifest+json
79+
application/rss+xml
80+
application/vnd.geo+json
81+
application/vnd.ms-fontobject
82+
application/x-font-ttf
83+
application/x-web-app-manifest+json
84+
application/xhtml+xml
85+
application/xml
86+
font/opentype
87+
image/bmp
88+
image/svg+xml
89+
image/x-icon
90+
text/cache-manifest
91+
text/css
92+
text/javascript
93+
text/plain
94+
text/vcard
95+
text/vnd.rim.location.xloc
96+
text/vtt
97+
text/x-component
98+
text/x-cross-domain-policy;
99+
100+
location /error/ {
101+
alias %home%/%user%/web/%domain%/document_errors/;
102+
}
103+
104+
location /vstats/ {
105+
alias %home%/%user%/web/%domain%/stats/;
106+
include %home%/%user%/web/%domain%/stats/auth.conf*;
107+
}
108+
109+
include /etc/nginx/conf.d/phpmyadmin.inc*;
110+
include /etc/nginx/conf.d/phppgadmin.inc*;
111+
include %home%/%user%/conf/web/%domain%/nginx.conf_*;
112+
}
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
#=========================================================================#
2+
# Default Web Domain Template #
3+
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
4+
# https://docs.hestiacp.com/admin_docs/web.html#how-do-web-templates-work #
5+
#=========================================================================#
6+
7+
server {
8+
listen %ip%:%web_port%;
9+
server_name %domain_idn% %alias_idn%;
10+
root %docroot%;
11+
index index.php index.html index.htm;
12+
access_log /var/log/nginx/domains/%domain%.log combined;
13+
access_log /var/log/nginx/domains/%domain%.bytes bytes;
14+
error_log /var/log/nginx/domains/%domain%.error.log error;
15+
16+
ssl_certificate %ssl_pem%;
17+
ssl_certificate_key %ssl_key%;
18+
ssl_stapling on;
19+
ssl_stapling_verify on;
20+
21+
include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;
22+
23+
# Pass requests that don't refer directly to files in the filesystem to index.php
24+
location / {
25+
try_files $uri $uri/ /index.php?$query_string;
26+
}
27+
28+
location ~ \.php$ {
29+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
30+
try_files $uri =404;
31+
fastcgi_pass %backend_lsnr%;
32+
fastcgi_index index.php;
33+
include /etc/nginx/fastcgi_params;
34+
include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
35+
}
36+
37+
#Uncomment the following lines if you are not using a `public` directory
38+
#to prevent sensitive resources from being exposed.
39+
location ~* ^/(\.git|composer\.(json|lock)|auth\.json|config\.php|flarum|storage|vendor) {
40+
deny all;
41+
return 404;
42+
}
43+
44+
# The following directives are based on best practices from H5BP Nginx Server Configs
45+
# https://github.com/h5bp/server-configs-nginx
46+
47+
# Expire rules for static content
48+
location ~* \.(?:manifest|appcache|html?|xml|json)$ {
49+
add_header Cache-Control "max-age=0";
50+
}
51+
52+
location ~* \.(?:rss|atom)$ {
53+
add_header Cache-Control "max-age=3600";
54+
}
55+
56+
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|mp4|ogg|ogv|webm|htc)$ {
57+
add_header Cache-Control "max-age=2592000";
58+
access_log off;
59+
}
60+
61+
location ~* \.(?:css|js)$ {
62+
add_header Cache-Control "max-age=31536000";
63+
access_log off;
64+
}
65+
66+
location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$ {
67+
add_header Cache-Control "max-age=2592000";
68+
access_log off;
69+
}
70+
71+
# Gzip compression
72+
gzip on;
73+
gzip_comp_level 5;
74+
gzip_min_length 256;
75+
gzip_proxied any;
76+
gzip_vary on;
77+
gzip_types
78+
application/atom+xml
79+
application/javascript
80+
application/json
81+
application/ld+json
82+
application/manifest+json
83+
application/rss+xml
84+
application/vnd.geo+json
85+
application/vnd.ms-fontobject
86+
application/x-font-ttf
87+
application/x-web-app-manifest+json
88+
application/xhtml+xml
89+
application/xml
90+
font/opentype
91+
image/bmp
92+
image/svg+xml
93+
image/x-icon
94+
text/cache-manifest
95+
text/css
96+
text/javascript
97+
text/plain
98+
text/vcard
99+
text/vnd.rim.location.xloc
100+
text/vtt
101+
text/x-component
102+
text/x-cross-domain-policy;
103+
104+
location /error/ {
105+
alias %home%/%user%/web/%domain%/document_errors/;
106+
}
107+
108+
location /vstats/ {
109+
alias %home%/%user%/web/%domain%/stats/;
110+
include %home%/%user%/web/%domain%/stats/auth.conf*;
111+
}
112+
113+
include /etc/nginx/conf.d/phpmyadmin.inc*;
114+
include /etc/nginx/conf.d/phppgadmin.inc*;
115+
include %home%/%user%/conf/web/%domain%/nginx.conf_*;
116+
}

0 commit comments

Comments
 (0)