Skip to content

Commit a3e2df3

Browse files
author
AlexVakhovski
committed
Create domain nginx template php_fastcgi
1 parent 6896a84 commit a3e2df3

File tree

1 file changed

+57
-2
lines changed

1 file changed

+57
-2
lines changed

dist/templates/nginx.conf.tmpl

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,65 @@
11
server {
22
listen 80;
33
server_name {{.Domain}};
4-
root /var/www/html;
54
index index.php index.html;
5+
charset off;
6+
7+
set $root_path /var/www/html;
8+
root $root_path;
9+
10+
client_max_body_size 108M;
11+
access_log /var/log/nginx/{{.Prefix}}_access.log;
12+
error_log /var/log/nginx/{{.Prefix}}_error.log notice;
13+
14+
gzip on;
15+
gzip_comp_level 5;
16+
gzip_disable "msie6";
17+
gzip_types
18+
text/plain
19+
text/css
20+
application/json
21+
application/javascript
22+
application/x-javascript
23+
text/javascript
24+
text/xml
25+
application/xml
26+
application/xml+rss;
627

728
location / {
8-
try_files $uri $uri/ /index.php?$query_string;
29+
try_files $uri $uri/ @rewrite;
30+
31+
location ~ [^/]\.ph(p\d*|tml)$ {
32+
try_files /does_not_exist @php;
33+
}
34+
35+
location ~* \.(avif|webp|jpg|jpeg|gif|png|svg|ico|mp4|webm|mkv|m4v|mp3|ogg|wav|aac|js|css|json|map|woff|woff2|ttf|otf|eot|zip|gz|bz2|rar|7z|tar)$ {
36+
access_log off;
37+
expires max;
38+
break;
39+
}
40+
}
41+
42+
location @rewrite {
43+
rewrite ^.*$ /index.php last;
44+
}
45+
46+
location @php {
47+
fastcgi_index index.php;
48+
fastcgi_pass {{.Prefix}}_php:9000;
49+
fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$;
50+
try_files $uri =404;
51+
include fastcgi_params;
52+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
53+
fastcgi_param PHP_VALUE "error_log=/var/log/nginx/{{.Prefix}}_php_error.log";
54+
}
55+
56+
location = /robots.txt {
57+
allow all;
58+
}
59+
60+
location = /sitemap.xml {
61+
allow all;
62+
add_header Content-Type text/xml;
63+
expires 1h;
964
}
1065
}

0 commit comments

Comments
 (0)