Skip to content

Commit f487bb7

Browse files
jaapmarcusmadito
andauthored
New PHP-FPM templates for... (hestiacp#2204)
* New templates: - Gitea - Projectsend - OpenProject - Symfony 2.X and 3.X - Symfony 4.X and 5.X * Remove buffer size Value was set to a lower value then in nginx.conf causing issues where nginx doesn't load Co-authored-by: Arturo Blanco <ablanco@ablanco.es>
1 parent 4dd95ac commit f487bb7

File tree

10 files changed

+652
-0
lines changed

10 files changed

+652
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
proxy_pass http://localhost:3000;
24+
}
25+
26+
location /error/ {
27+
alias %home%/%user%/web/%domain%/document_errors/;
28+
}
29+
30+
location ~ /\.(?!well-known\/) {
31+
deny all;
32+
return 404;
33+
}
34+
35+
location /vstats/ {
36+
alias %home%/%user%/web/%domain%/stats/;
37+
include %home%/%user%/web/%domain%/stats/auth.conf*;
38+
}
39+
40+
include /etc/nginx/conf.d/phpmyadmin.inc*;
41+
include /etc/nginx/conf.d/phppgadmin.inc*;
42+
include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
43+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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+
proxy_pass http://localhost:3000;
19+
}
20+
21+
location /error/ {
22+
alias %home%/%user%/web/%domain%/document_errors/;
23+
}
24+
25+
location ~ /\.(?!well-known\/) {
26+
deny all;
27+
return 404;
28+
}
29+
30+
location /vstats/ {
31+
alias %home%/%user%/web/%domain%/stats/;
32+
include %home%/%user%/web/%domain%/stats/auth.conf*;
33+
}
34+
35+
include /etc/nginx/conf.d/phpmyadmin.inc*;
36+
include /etc/nginx/conf.d/phppgadmin.inc*;
37+
include %home%/%user%/conf/web/%domain%/nginx.conf_*;
38+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
proxy_pass http://127.0.0.1:6000;
24+
proxy_set_header Host $host;
25+
proxy_set_header X-Real-IP $remote_addr;
26+
proxy_set_header X-Forwarded-Port 443;
27+
proxy_set_header X-Forwarded-Proto https;
28+
}
29+
30+
location /error/ {
31+
alias %home%/%user%/web/%domain%/document_errors/;
32+
}
33+
34+
location ~ /\.(?!well-known\/) {
35+
deny all;
36+
return 404;
37+
}
38+
39+
location /vstats/ {
40+
alias %home%/%user%/web/%domain%/stats/;
41+
include %home%/%user%/web/%domain%/stats/auth.conf*;
42+
}
43+
44+
include /etc/nginx/conf.d/phpmyadmin.inc*;
45+
include /etc/nginx/conf.d/phppgadmin.inc*;
46+
include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
47+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
proxy_pass http://127.0.0.1:6000;
19+
proxy_set_header Host $host;
20+
proxy_set_header X-Real-IP $remote_addr;
21+
}
22+
23+
location /error/ {
24+
alias %home%/%user%/web/%domain%/document_errors/;
25+
}
26+
27+
location ~ /\.(?!well-known\/) {
28+
deny all;
29+
return 404;
30+
}
31+
32+
location /vstats/ {
33+
alias %home%/%user%/web/%domain%/stats/;
34+
include %home%/%user%/web/%domain%/stats/auth.conf*;
35+
}
36+
37+
include /etc/nginx/conf.d/phpmyadmin.inc*;
38+
include /etc/nginx/conf.d/phppgadmin.inc*;
39+
include %home%/%user%/conf/web/%domain%/nginx.conf_*;
40+
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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+
# Add headers to serve security related headers
23+
add_header X-Content-Type-Options nosniff;
24+
add_header X-XSS-Protection "1; mode=block";
25+
add_header X-Robots-Tag none;
26+
add_header X-Download-Options noopen;
27+
add_header X-Permitted-Cross-Domain-Policies none;
28+
add_header Referrer-Policy no-referrer;
29+
30+
location = /robots.txt {
31+
allow all;
32+
log_not_found off;
33+
access_log off;
34+
}
35+
36+
# set max upload size
37+
client_max_body_size 512M;
38+
39+
# Disable gzip to avoid the removal of the ETag header
40+
gzip off;
41+
42+
# Uncomment if your server is build with the ngx_pagespeed module
43+
# This module is currently not supported.
44+
#pagespeed off;
45+
46+
error_page 403 /core/templates/403.php;
47+
error_page 404 /core/templates/404.php;
48+
49+
location / {
50+
try_files $uri $uri/ /index.php;
51+
}
52+
53+
location ~ \.php$ {
54+
include fastcgi_params;
55+
fastcgi_split_path_info ^(.+\.php)(/.*)$;
56+
try_files $fastcgi_script_name =404;
57+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
58+
fastcgi_param PATH_INFO $fastcgi_path_info;
59+
#Avoid sending the security headers twice
60+
fastcgi_param modHeadersAvailable true;
61+
fastcgi_param front_controller_active true;
62+
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
63+
fastcgi_intercept_errors on;
64+
fastcgi_request_buffering off;
65+
}
66+
67+
location ~* \.(?:svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$ {
68+
try_files $uri /index.php$uri$is_args$args;
69+
# Optional: Don't log access to other assets
70+
access_log off;
71+
}
72+
73+
location /error/ {
74+
alias %home%/%user%/web/%domain%/document_errors/;
75+
}
76+
77+
location ~ /\.(?!well-known\/) {
78+
deny all;
79+
return 404;
80+
}
81+
82+
location /vstats/ {
83+
alias %home%/%user%/web/%domain%/stats/;
84+
include %home%/%user%/web/%domain%/stats/auth.conf*;
85+
}
86+
87+
include /etc/nginx/conf.d/phpmyadmin.inc*;
88+
include /etc/nginx/conf.d/phppgadmin.inc*;
89+
include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
90+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
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+
# Add headers to serve security related headers
18+
add_header X-Content-Type-Options nosniff;
19+
add_header X-XSS-Protection "1; mode=block";
20+
add_header X-Robots-Tag none;
21+
add_header X-Download-Options noopen;
22+
add_header X-Permitted-Cross-Domain-Policies none;
23+
add_header Referrer-Policy no-referrer;
24+
25+
location = /robots.txt {
26+
allow all;
27+
log_not_found off;
28+
access_log off;
29+
}
30+
31+
client_max_body_size 512M;
32+
33+
# Disable gzip to avoid the removal of the ETag header
34+
gzip off;
35+
36+
# Uncomment if your server is build with the ngx_pagespeed module
37+
# This module is currently not supported.
38+
#pagespeed off;
39+
40+
error_page 403 /core/templates/403.php;
41+
error_page 404 /core/templates/404.php;
42+
43+
location / {
44+
try_files $uri $uri/ /index.php;
45+
}
46+
47+
location ~ \.php$ {
48+
include fastcgi_params;
49+
fastcgi_split_path_info ^(.+\.php)(/.*)$;
50+
try_files $fastcgi_script_name =404;
51+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
52+
fastcgi_param PATH_INFO $fastcgi_path_info;
53+
#Avoid sending the security headers twice
54+
fastcgi_param modHeadersAvailable true;
55+
fastcgi_param front_controller_active true;
56+
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
57+
fastcgi_intercept_errors on;
58+
fastcgi_request_buffering off;
59+
}
60+
61+
location ~* \.(?:svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$ {
62+
try_files $uri /index.php$uri$is_args$args;
63+
# Optional: Don't log access to other assets
64+
access_log off;
65+
}
66+
67+
location /error/ {
68+
alias %home%/%user%/web/%domain%/document_errors/;
69+
}
70+
71+
location ~ /\.(?!well-known\/) {
72+
deny all;
73+
return 404;
74+
}
75+
76+
location /vstats/ {
77+
alias %home%/%user%/web/%domain%/stats/;
78+
include %home%/%user%/web/%domain%/stats/auth.conf*;
79+
}
80+
81+
include /etc/nginx/conf.d/phpmyadmin.inc*;
82+
include /etc/nginx/conf.d/phppgadmin.inc*;
83+
include %home%/%user%/conf/web/%domain%/nginx.conf_*;
84+
}

0 commit comments

Comments
 (0)