Skip to content

Commit e5b8cfb

Browse files
authored
Add phpBB Nginx template (hestiacp#3731)
* Add phpBB Nginx template * Add phpBB Nginx template to install/deb
1 parent 73e46d9 commit e5b8cfb

File tree

4 files changed

+442
-0
lines changed

4 files changed

+442
-0
lines changed
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
#=========================================================================#
2+
# Default Web Domain Template #
3+
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
4+
# https://hestiacp.com/docs/server-administration/web-templates.html #
5+
#=========================================================================#
6+
7+
server {
8+
listen %ip%:%web_ssl_port% ssl;
9+
server_name %domain_idn% %alias_idn%;
10+
root %sdocroot%;
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+
# TLS 1.3 0-RTT anti-replay
22+
if ($anti_replay = 307) { return 307 https://$host$request_uri; }
23+
if ($anti_replay = 425) { return 425; }
24+
25+
include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;
26+
27+
location = /favicon.ico {
28+
log_not_found off;
29+
access_log off;
30+
}
31+
32+
location = /robots.txt {
33+
allow all;
34+
log_not_found off;
35+
access_log off;
36+
}
37+
38+
location ~ /\.(?!well-known\/) {
39+
deny all;
40+
return 404;
41+
}
42+
43+
# Based on: https://github.com/phpbb/phpbb/blob/master/phpBB/docs/nginx.sample.conf
44+
location / {
45+
try_files $uri $uri/ @rewriteapp;
46+
47+
location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|webp|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
48+
fastcgi_hide_header "Set-Cookie";
49+
}
50+
51+
# Pass the php scripts to FastCGI server specified in upstream declaration.
52+
location ~ \.php(/|$) {
53+
include /etc/nginx/fastcgi_params;
54+
55+
fastcgi_index index.php;
56+
fastcgi_split_path_info ^(.+\.php)(/.*)$;
57+
fastcgi_param PATH_INFO $fastcgi_path_info;
58+
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
59+
#fastcgi_param HTTP_EARLY_DATA $rfc_early_data if_not_empty;
60+
61+
fastcgi_pass %backend_lsnr%;
62+
include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
63+
64+
try_files $uri $uri/ /app.php$is_args$args;
65+
}
66+
67+
# Deny access to internal phpbb files.
68+
location ~ /(config\.php|common\.php|cache|files|images/avatars/upload|includes|(?<!ext/)phpbb(?!\w+)|store|vendor) {
69+
deny all;
70+
return 404;
71+
}
72+
}
73+
74+
location @rewriteapp {
75+
rewrite ^(.*)$ /app.php/$1 last;
76+
}
77+
78+
# Correctly pass scripts for installer
79+
location /install/ {
80+
try_files $uri $uri/ @rewrite_installapp =404;
81+
82+
# Pass the php scripts to fastcgi server specified in upstream declaration.
83+
location ~ \.php(/|$) {
84+
include /etc/nginx/fastcgi_params;
85+
86+
fastcgi_index index.php;
87+
fastcgi_split_path_info ^(.+\.php)(/.*)$;
88+
fastcgi_param PATH_INFO $fastcgi_path_info;
89+
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
90+
#fastcgi_param HTTP_EARLY_DATA $rfc_early_data if_not_empty;
91+
92+
fastcgi_pass %backend_lsnr%;
93+
include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
94+
95+
try_files $uri $uri/ /install/app.php$is_args$args =404;
96+
}
97+
}
98+
99+
location @rewrite_installapp {
100+
rewrite ^(.*)$ /install/app.php/$1 last;
101+
}
102+
103+
location /error/ {
104+
alias %home%/%user%/web/%domain%/document_errors/;
105+
}
106+
107+
location /vstats/ {
108+
alias %home%/%user%/web/%domain%/stats/;
109+
include %home%/%user%/web/%domain%/stats/auth.conf*;
110+
}
111+
112+
proxy_hide_header Upgrade;
113+
114+
include /etc/nginx/conf.d/phpmyadmin.inc*;
115+
include /etc/nginx/conf.d/phppgadmin.inc*;
116+
include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
117+
}
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
#=========================================================================#
2+
# Default Web Domain Template #
3+
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
4+
# https://hestiacp.com/docs/server-administration/web-templates.html #
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+
include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;
17+
18+
location = /favicon.ico {
19+
log_not_found off;
20+
access_log off;
21+
}
22+
23+
location = /robots.txt {
24+
allow all;
25+
log_not_found off;
26+
access_log off;
27+
}
28+
29+
location ~ /\.(?!well-known\/) {
30+
deny all;
31+
return 404;
32+
}
33+
34+
# Based on: https://github.com/phpbb/phpbb/blob/master/phpBB/docs/nginx.sample.conf
35+
location / {
36+
try_files $uri $uri/ @rewriteapp;
37+
38+
location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|webp|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
39+
fastcgi_hide_header "Set-Cookie";
40+
}
41+
42+
# Pass the php scripts to FastCGI server specified in upstream declaration.
43+
location ~ \.php(/|$) {
44+
include /etc/nginx/fastcgi_params;
45+
46+
fastcgi_index index.php;
47+
fastcgi_split_path_info ^(.+\.php)(/.*)$;
48+
fastcgi_param PATH_INFO $fastcgi_path_info;
49+
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
50+
51+
fastcgi_pass %backend_lsnr%;
52+
include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
53+
54+
try_files $uri $uri/ /app.php$is_args$args;
55+
}
56+
57+
# Deny access to internal phpbb files.
58+
location ~ /(config\.php|common\.php|cache|files|images/avatars/upload|includes|(?<!ext/)phpbb(?!\w+)|store|vendor) {
59+
deny all;
60+
return 404;
61+
}
62+
}
63+
64+
location @rewriteapp {
65+
rewrite ^(.*)$ /app.php/$1 last;
66+
}
67+
68+
# Correctly pass scripts for installer
69+
location /install/ {
70+
try_files $uri $uri/ @rewrite_installapp =404;
71+
72+
# Pass the php scripts to fastcgi server specified in upstream declaration.
73+
location ~ \.php(/|$) {
74+
include /etc/nginx/fastcgi_params;
75+
76+
fastcgi_index index.php;
77+
fastcgi_split_path_info ^(.+\.php)(/.*)$;
78+
fastcgi_param PATH_INFO $fastcgi_path_info;
79+
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
80+
81+
fastcgi_pass %backend_lsnr%;
82+
include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
83+
84+
try_files $uri $uri/ /install/app.php$is_args$args =404;
85+
}
86+
}
87+
88+
location @rewrite_installapp {
89+
rewrite ^(.*)$ /install/app.php/$1 last;
90+
}
91+
92+
location /error/ {
93+
alias %home%/%user%/web/%domain%/document_errors/;
94+
}
95+
96+
location /vstats/ {
97+
alias %home%/%user%/web/%domain%/stats/;
98+
include %home%/%user%/web/%domain%/stats/auth.conf*;
99+
}
100+
101+
include /etc/nginx/conf.d/phpmyadmin.inc*;
102+
include /etc/nginx/conf.d/phppgadmin.inc*;
103+
include %home%/%user%/conf/web/%domain%/nginx.conf_*;
104+
}
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
#=========================================================================#
2+
# Default Web Domain Template #
3+
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
4+
# https://hestiacp.com/docs/server-administration/web-templates.html #
5+
#=========================================================================#
6+
7+
server {
8+
listen %ip%:%web_ssl_port% ssl;
9+
server_name %domain_idn% %alias_idn%;
10+
root %sdocroot%;
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+
# TLS 1.3 0-RTT anti-replay
22+
if ($anti_replay = 307) { return 307 https://$host$request_uri; }
23+
if ($anti_replay = 425) { return 425; }
24+
25+
include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;
26+
27+
location = /favicon.ico {
28+
log_not_found off;
29+
access_log off;
30+
}
31+
32+
location = /robots.txt {
33+
allow all;
34+
log_not_found off;
35+
access_log off;
36+
}
37+
38+
location ~ /\.(?!well-known\/) {
39+
deny all;
40+
return 404;
41+
}
42+
43+
# Based on: https://github.com/phpbb/phpbb/blob/master/phpBB/docs/nginx.sample.conf
44+
location / {
45+
try_files $uri $uri/ @rewriteapp;
46+
47+
location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|webp|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
48+
fastcgi_hide_header "Set-Cookie";
49+
}
50+
51+
# Pass the php scripts to FastCGI server specified in upstream declaration.
52+
location ~ \.php(/|$) {
53+
include /etc/nginx/fastcgi_params;
54+
55+
fastcgi_index index.php;
56+
fastcgi_split_path_info ^(.+\.php)(/.*)$;
57+
fastcgi_param PATH_INFO $fastcgi_path_info;
58+
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
59+
#fastcgi_param HTTP_EARLY_DATA $rfc_early_data if_not_empty;
60+
61+
fastcgi_pass %backend_lsnr%;
62+
include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
63+
64+
try_files $uri $uri/ /app.php$is_args$args;
65+
}
66+
67+
# Deny access to internal phpbb files.
68+
location ~ /(config\.php|common\.php|cache|files|images/avatars/upload|includes|(?<!ext/)phpbb(?!\w+)|store|vendor) {
69+
deny all;
70+
return 404;
71+
}
72+
}
73+
74+
location @rewriteapp {
75+
rewrite ^(.*)$ /app.php/$1 last;
76+
}
77+
78+
# Correctly pass scripts for installer
79+
location /install/ {
80+
try_files $uri $uri/ @rewrite_installapp =404;
81+
82+
# Pass the php scripts to fastcgi server specified in upstream declaration.
83+
location ~ \.php(/|$) {
84+
include /etc/nginx/fastcgi_params;
85+
86+
fastcgi_index index.php;
87+
fastcgi_split_path_info ^(.+\.php)(/.*)$;
88+
fastcgi_param PATH_INFO $fastcgi_path_info;
89+
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
90+
#fastcgi_param HTTP_EARLY_DATA $rfc_early_data if_not_empty;
91+
92+
fastcgi_pass %backend_lsnr%;
93+
include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
94+
95+
try_files $uri $uri/ /install/app.php$is_args$args =404;
96+
}
97+
}
98+
99+
location @rewrite_installapp {
100+
rewrite ^(.*)$ /install/app.php/$1 last;
101+
}
102+
103+
location /error/ {
104+
alias %home%/%user%/web/%domain%/document_errors/;
105+
}
106+
107+
location /vstats/ {
108+
alias %home%/%user%/web/%domain%/stats/;
109+
include %home%/%user%/web/%domain%/stats/auth.conf*;
110+
}
111+
112+
proxy_hide_header Upgrade;
113+
114+
include /etc/nginx/conf.d/phpmyadmin.inc*;
115+
include /etc/nginx/conf.d/phppgadmin.inc*;
116+
include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
117+
}

0 commit comments

Comments
 (0)