Skip to content

Commit 79c3260

Browse files
authored
Merge pull request hestiacp#1276 from gdevdeiv/master
Added Magento web template (latest version, 2.1).
2 parents 0724f4c + dd5ba84 commit 79c3260

File tree

30 files changed

+5880
-0
lines changed

30 files changed

+5880
-0
lines changed
Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
server {
2+
listen %ip%:%web_ssl_port%;
3+
server_name %domain_idn% %alias_idn%;
4+
5+
root %sdocroot%/pub;
6+
index index.php;
7+
autoindex off;
8+
charset UTF-8;
9+
error_page 404 403 = /errors/404.php;
10+
add_header "X-UA-Compatible" "IE=Edge";
11+
12+
ssl on;
13+
ssl_certificate %ssl_pem%;
14+
ssl_certificate_key %ssl_key%;
15+
16+
access_log /var/log/nginx/domains/%domain%.log combined;
17+
access_log /var/log/nginx/domains/%domain%.bytes bytes;
18+
error_log /var/log/nginx/domains/%domain%.error.log error;
19+
20+
# PHP entry point for setup application
21+
location ~* ^/setup($|/) {
22+
root %sdocroot%;
23+
24+
location ~ ^/setup/index.php {
25+
fastcgi_pass %backend_lsnr%;
26+
fastcgi_index index.php;
27+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
28+
include /etc/nginx/fastcgi_params;
29+
}
30+
31+
location ~ ^/setup/(?!pub/). {
32+
deny all;
33+
}
34+
35+
location ~ ^/setup/pub/ {
36+
add_header X-Frame-Options "SAMEORIGIN";
37+
}
38+
}
39+
40+
# PHP entry point for update application
41+
location ~* ^/update($|/) {
42+
root %sdocroot%;
43+
44+
location ~ ^/update/index.php {
45+
fastcgi_split_path_info ^(/update/index.php)(/.+)$;
46+
fastcgi_pass %backend_lsnr%;
47+
fastcgi_index index.php;
48+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
49+
fastcgi_param PATH_INFO $fastcgi_path_info;
50+
include /etc/nginx/fastcgi_params;
51+
}
52+
53+
# Deny everything but index.php
54+
location ~ ^/update/(?!pub/). {
55+
deny all;
56+
}
57+
58+
location ~ ^/update/pub/ {
59+
add_header X-Frame-Options "SAMEORIGIN";
60+
}
61+
}
62+
63+
location / {
64+
try_files $uri $uri/ /index.php?$args;
65+
}
66+
67+
location /pub/ {
68+
location ~ ^/pub/media/(downloadable|customer|import|theme_customization/.*\.xml) {
69+
deny all;
70+
}
71+
72+
alias %sdocroot%/pub/;
73+
add_header X-Frame-Options "SAMEORIGIN";
74+
}
75+
76+
location /static/ {
77+
# Uncomment the following line in production mode
78+
# expires max;
79+
80+
# Remove signature of the static files that is used to overcome the browser cache
81+
location ~ ^/static/version {
82+
rewrite ^/static/(version\d*/)?(.*)$ /static/$2 last;
83+
}
84+
85+
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
86+
add_header Cache-Control "public";
87+
add_header X-Frame-Options "SAMEORIGIN";
88+
expires +1y;
89+
90+
if (!-f $request_filename) {
91+
rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
92+
}
93+
}
94+
95+
location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
96+
add_header Cache-Control "no-store";
97+
add_header X-Frame-Options "SAMEORIGIN";
98+
expires off;
99+
100+
if (!-f $request_filename) {
101+
rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
102+
}
103+
}
104+
105+
if (!-f $request_filename) {
106+
rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
107+
}
108+
109+
add_header X-Frame-Options "SAMEORIGIN";
110+
}
111+
112+
location /media/ {
113+
try_files $uri $uri/ /get.php?$args;
114+
115+
location ~ ^/media/theme_customization/.*\.xml {
116+
deny all;
117+
}
118+
119+
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
120+
add_header Cache-Control "public";
121+
add_header X-Frame-Options "SAMEORIGIN";
122+
expires +1y;
123+
try_files $uri $uri/ /get.php?$args;
124+
}
125+
126+
location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
127+
add_header Cache-Control "no-store";
128+
add_header X-Frame-Options "SAMEORIGIN";
129+
expires off;
130+
try_files $uri $uri/ /get.php?$args;
131+
}
132+
133+
add_header X-Frame-Options "SAMEORIGIN";
134+
}
135+
136+
location /media/customer/ {
137+
deny all;
138+
}
139+
140+
location /media/downloadable/ {
141+
deny all;
142+
}
143+
144+
location /media/import/ {
145+
deny all;
146+
}
147+
148+
# PHP entry point for main application
149+
location ~ (index|get|static|report|404|503)\.php$ {
150+
try_files $uri =404;
151+
152+
fastcgi_pass %backend_lsnr%;
153+
fastcgi_buffers 1024 4k;
154+
fastcgi_read_timeout 600s;
155+
fastcgi_connect_timeout 600s;
156+
157+
fastcgi_index index.php;
158+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
159+
include /etc/nginx/fastcgi_params;
160+
}
161+
162+
gzip on;
163+
gzip_disable "msie6";
164+
165+
gzip_comp_level 6;
166+
gzip_min_length 1100;
167+
gzip_buffers 16 8k;
168+
gzip_proxied any;
169+
gzip_types
170+
text/plain
171+
text/css
172+
text/js
173+
text/xml
174+
text/javascript
175+
application/javascript
176+
application/x-javascript
177+
application/json
178+
application/xml
179+
application/xml+rss
180+
image/svg+xml;
181+
gzip_vary on;
182+
183+
# Banned locations (only reached if the earlier PHP entry point regexes don't match)
184+
location ~* (\.php$|\.htaccess$|\.git) {
185+
deny all;
186+
}
187+
188+
location /vstats/ {
189+
alias %home%/%user%/web/%domain%/stats/;
190+
include %home%/%user%/web/%domain%/stats/auth.conf*;
191+
}
192+
193+
include /etc/nginx/conf.d/phpmyadmin.inc*;
194+
include /etc/nginx/conf.d/phppgadmin.inc*;
195+
include /etc/nginx/conf.d/webmail.inc*;
196+
197+
include %home%/%user%/conf/web/nginx.%domain_idn%.conf*;
198+
}
Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
server {
2+
listen %ip%:%web_port%;
3+
server_name %domain_idn% %alias_idn%;
4+
5+
root %docroot%/pub;
6+
index index.php;
7+
autoindex off;
8+
charset UTF-8;
9+
error_page 404 403 = /errors/404.php;
10+
add_header "X-UA-Compatible" "IE=Edge";
11+
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+
# PHP entry point for setup application
17+
location ~* ^/setup($|/) {
18+
root %docroot%;
19+
20+
location ~ ^/setup/index.php {
21+
fastcgi_pass %backend_lsnr%;
22+
fastcgi_index index.php;
23+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
24+
include /etc/nginx/fastcgi_params;
25+
}
26+
27+
location ~ ^/setup/(?!pub/). {
28+
deny all;
29+
}
30+
31+
location ~ ^/setup/pub/ {
32+
add_header X-Frame-Options "SAMEORIGIN";
33+
}
34+
}
35+
36+
# PHP entry point for update application
37+
location ~* ^/update($|/) {
38+
root %docroot%;
39+
40+
location ~ ^/update/index.php {
41+
fastcgi_split_path_info ^(/update/index.php)(/.+)$;
42+
fastcgi_pass %backend_lsnr%;
43+
fastcgi_index index.php;
44+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
45+
fastcgi_param PATH_INFO $fastcgi_path_info;
46+
include /etc/nginx/fastcgi_params;
47+
}
48+
49+
# Deny everything but index.php
50+
location ~ ^/update/(?!pub/). {
51+
deny all;
52+
}
53+
54+
location ~ ^/update/pub/ {
55+
add_header X-Frame-Options "SAMEORIGIN";
56+
}
57+
}
58+
59+
location / {
60+
try_files $uri $uri/ /index.php?$args;
61+
}
62+
63+
location /pub/ {
64+
location ~ ^/pub/media/(downloadable|customer|import|theme_customization/.*\.xml) {
65+
deny all;
66+
}
67+
68+
alias %docroot%/pub/;
69+
add_header X-Frame-Options "SAMEORIGIN";
70+
}
71+
72+
location /static/ {
73+
# Uncomment the following line in production mode
74+
# expires max;
75+
76+
# Remove signature of the static files that is used to overcome the browser cache
77+
location ~ ^/static/version {
78+
rewrite ^/static/(version\d*/)?(.*)$ /static/$2 last;
79+
}
80+
81+
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
82+
add_header Cache-Control "public";
83+
add_header X-Frame-Options "SAMEORIGIN";
84+
expires +1y;
85+
86+
if (!-f $request_filename) {
87+
rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
88+
}
89+
}
90+
91+
location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
92+
add_header Cache-Control "no-store";
93+
add_header X-Frame-Options "SAMEORIGIN";
94+
expires off;
95+
96+
if (!-f $request_filename) {
97+
rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
98+
}
99+
}
100+
101+
if (!-f $request_filename) {
102+
rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
103+
}
104+
105+
add_header X-Frame-Options "SAMEORIGIN";
106+
}
107+
108+
location /media/ {
109+
try_files $uri $uri/ /get.php?$args;
110+
111+
location ~ ^/media/theme_customization/.*\.xml {
112+
deny all;
113+
}
114+
115+
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
116+
add_header Cache-Control "public";
117+
add_header X-Frame-Options "SAMEORIGIN";
118+
expires +1y;
119+
try_files $uri $uri/ /get.php?$args;
120+
}
121+
122+
location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
123+
add_header Cache-Control "no-store";
124+
add_header X-Frame-Options "SAMEORIGIN";
125+
expires off;
126+
try_files $uri $uri/ /get.php?$args;
127+
}
128+
129+
add_header X-Frame-Options "SAMEORIGIN";
130+
}
131+
132+
location /media/customer/ {
133+
deny all;
134+
}
135+
136+
location /media/downloadable/ {
137+
deny all;
138+
}
139+
140+
location /media/import/ {
141+
deny all;
142+
}
143+
144+
# PHP entry point for main application
145+
location ~ (index|get|static|report|404|503)\.php$ {
146+
try_files $uri =404;
147+
148+
fastcgi_pass %backend_lsnr%;
149+
fastcgi_buffers 1024 4k;
150+
fastcgi_read_timeout 600s;
151+
fastcgi_connect_timeout 600s;
152+
153+
fastcgi_index index.php;
154+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
155+
include /etc/nginx/fastcgi_params;
156+
}
157+
158+
gzip on;
159+
gzip_disable "msie6";
160+
161+
gzip_comp_level 6;
162+
gzip_min_length 1100;
163+
gzip_buffers 16 8k;
164+
gzip_proxied any;
165+
gzip_types
166+
text/plain
167+
text/css
168+
text/js
169+
text/xml
170+
text/javascript
171+
application/javascript
172+
application/x-javascript
173+
application/json
174+
application/xml
175+
application/xml+rss
176+
image/svg+xml;
177+
gzip_vary on;
178+
179+
# Banned locations (only reached if the earlier PHP entry point regexes don't match)
180+
location ~* (\.php$|\.htaccess$|\.git) {
181+
deny all;
182+
}
183+
184+
location /vstats/ {
185+
alias %home%/%user%/web/%domain%/stats/;
186+
include %home%/%user%/web/%domain%/stats/auth.conf*;
187+
}
188+
189+
include /etc/nginx/conf.d/phpmyadmin.inc*;
190+
include /etc/nginx/conf.d/phppgadmin.inc*;
191+
include /etc/nginx/conf.d/webmail.inc*;
192+
193+
include %home%/%user%/conf/web/nginx.%domain_idn%.conf*;
194+
}

0 commit comments

Comments
 (0)