Skip to content

Commit 8220b2a

Browse files
authored
template for using webasyst with nginx+php-fpm (hestiacp#4660)
1 parent a51f41f commit 8220b2a

File tree

2 files changed

+410
-0
lines changed

2 files changed

+410
-0
lines changed
Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
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+
try_files $uri $uri/ /index.php?$args;
34+
log_not_found off;
35+
access_log off;
36+
}
37+
38+
location ~ /\.(?!well-known\/) {
39+
deny all;
40+
return 404;
41+
}
42+
43+
## ---
44+
45+
try_files $uri $uri/ /index.php?$query_string;
46+
47+
location /index.php {
48+
include /etc/nginx/fastcgi_params;
49+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
50+
fastcgi_param PATH_INFO $fastcgi_path_info;
51+
fastcgi_pass %backend_lsnr%;
52+
}
53+
54+
# for install only
55+
location /install.php {
56+
include /etc/nginx/fastcgi_params;
57+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
58+
fastcgi_param PATH_INFO $fastcgi_path_info;
59+
fastcgi_pass %backend_lsnr%;
60+
}
61+
62+
location /api.php {
63+
fastcgi_split_path_info ^(.+\.php)(.*)$;
64+
include /etc/nginx/fastcgi_params;
65+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
66+
fastcgi_param PATH_INFO $fastcgi_path_info;
67+
fastcgi_pass %backend_lsnr%;
68+
}
69+
70+
location ~ /(oauth.php|link.php|payments.php|captcha.php) {
71+
try_files $uri $uri/ /index.php?$query_string;
72+
}
73+
74+
location ^~ /wa-data/protected/ {
75+
internal;
76+
}
77+
78+
location ~ /wa-content {
79+
allow all;
80+
}
81+
82+
location ~ /wa-apps/[^/]+/(plugins/[^/]+/)?(lib|locale|templates)/ {
83+
deny all;
84+
}
85+
86+
location ~ /(wa-plugins/([^/]+)|wa-widgets)/.+/(lib|locale|templates)/ {
87+
deny all;
88+
}
89+
90+
location ~* ^/wa-(cache|config|installer|log|system)/ {
91+
return 403;
92+
}
93+
94+
location ~* ^/wa-data/public/contacts/photos/[0-9]+/ {
95+
root /var/www/fw/;
96+
access_log off;
97+
expires 30d;
98+
error_page 404 = @contacts_thumb;
99+
}
100+
101+
location @contacts_thumb {
102+
include /etc/nginx/fastcgi_params;
103+
fastcgi_pass %backend_lsnr%;
104+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
105+
fastcgi_param PATH_INFO $fastcgi_path_info;
106+
fastcgi_param SCRIPT_NAME /wa-data/public/contacts/photos/thumb.php;
107+
fastcgi_param SCRIPT_FILENAME $document_root/wa-data/public/contacts/photos/thumb.php;
108+
}
109+
110+
# photos app
111+
location ~* ^/wa-data/public/photos/[0-9]+/ {
112+
access_log off;
113+
expires 30d;
114+
error_page 404 = @photos_thumb;
115+
}
116+
117+
location @photos_thumb {
118+
include /etc/nginx/fastcgi_params;
119+
fastcgi_pass %backend_lsnr%;
120+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
121+
fastcgi_param PATH_INFO $fastcgi_path_info;
122+
fastcgi_param SCRIPT_NAME /wa-data/public/photos/thumb.php;
123+
fastcgi_param SCRIPT_FILENAME $document_root/wa-data/public/photos/thumb.php;
124+
}
125+
# end photos app
126+
127+
# shop app
128+
location ~* ^/wa-data/public/shop/products/[0-9]+/ {
129+
access_log off;
130+
expires 30d;
131+
error_page 404 = @shop_thumb;
132+
}
133+
location @shop_thumb {
134+
include /etc/nginx/fastcgi_params;
135+
fastcgi_pass %backend_lsnr%;
136+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
137+
fastcgi_param PATH_INFO $fastcgi_path_info;
138+
fastcgi_param SCRIPT_NAME /wa-data/public/shop/products/thumb.php;
139+
fastcgi_param SCRIPT_FILENAME $document_root/wa-data/public/shop/products/thumb.php;
140+
}
141+
142+
location ~* ^/wa-data/public/shop/promos/[0-9]+ {
143+
access_log off;
144+
expires 30d;
145+
error_page 404 = @shop_promo;
146+
}
147+
location @shop_promo {
148+
include /etc/nginx/fastcgi_params;
149+
fastcgi_pass %backend_lsnr%;
150+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
151+
fastcgi_param PATH_INFO $fastcgi_path_info;
152+
fastcgi_param SCRIPT_NAME /wa-data/public/shop/promos/thumb.php;
153+
fastcgi_param SCRIPT_FILENAME $document_root/wa-data/public/shop/promos/thumb.php;
154+
}
155+
# end shop app
156+
157+
# mailer app
158+
location ~* ^/wa-data/public/mailer/files/[0-9]+/ {
159+
access_log off;
160+
error_page 404 = @mailer_file;
161+
}
162+
location @mailer_file {
163+
include /etc/nginx/fastcgi_params;
164+
fastcgi_pass %backend_lsnr%;
165+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
166+
fastcgi_param PATH_INFO $fastcgi_path_info;
167+
fastcgi_param SCRIPT_NAME /wa-data/public/mailer/files/file.php;
168+
fastcgi_param SCRIPT_FILENAME $document_root/wa-data/public/mailer/files/file.php;
169+
}
170+
# end mailer app
171+
172+
# tasks app
173+
location ~* ^/wa-data/public/tasks/tasks/[0-9]+/ {
174+
access_log off;
175+
expires 30d;
176+
error_page 404 = @tasks_thumb;
177+
}
178+
179+
location @tasks_thumb {
180+
include /etc/nginx/fastcgi_params;
181+
fastcgi_pass %backend_lsnr%;
182+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
183+
fastcgi_param PATH_INFO $fastcgi_path_info;
184+
fastcgi_param SCRIPT_NAME /wa-data/public/tasks/tasks/thumb.php;
185+
fastcgi_param SCRIPT_FILENAME $document_root/wa-data/public/tasks/tasks/thumb.php;
186+
}
187+
# end tasks app
188+
189+
location ~* ^.+\.(jpg|jpeg|gif|png|webp|js|css)$ {
190+
access_log off;
191+
expires 30d;
192+
}
193+
194+
195+
## ---
196+
197+
location /error/ {
198+
alias %home%/%user%/web/%domain%/document_errors/;
199+
}
200+
201+
location /vstats/ {
202+
alias %home%/%user%/web/%domain%/stats/;
203+
include %home%/%user%/web/%domain%/stats/auth.conf*;
204+
}
205+
206+
proxy_hide_header Upgrade;
207+
208+
include /etc/nginx/conf.d/phpmyadmin.inc*;
209+
include /etc/nginx/conf.d/phppgadmin.inc*;
210+
include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
211+
}

0 commit comments

Comments
 (0)