Skip to content

Commit 340add2

Browse files
author
Alexandros Ioannides
authored
Update modx.tpl
1 parent 333c401 commit 340add2

File tree

1 file changed

+34
-26
lines changed
  • install/deb/templates/web/nginx/php-fpm

1 file changed

+34
-26
lines changed

install/deb/templates/web/nginx/php-fpm/modx.tpl

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,9 @@ server {
1111
access_log /var/log/nginx/domains/%domain%.log combined;
1212
access_log /var/log/nginx/domains/%domain%.bytes bytes;
1313
error_log /var/log/nginx/domains/%domain%.error.log error;
14-
14+
1515
include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;
16-
# if you need to rewrite www to non-www uncomment bellow
17-
# if ($host != '%domain%' ) {
18-
# rewrite ^/(.*)$ http://%domain%/$1 permanent;
19-
# }
16+
2017
location = /favicon.ico {
2118
log_not_found off;
2219
access_log off;
@@ -28,41 +25,52 @@ server {
2825
access_log off;
2926
}
3027

31-
location / {
32-
try_files $uri $uri/ @rewrite;
33-
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
34-
expires max;
35-
fastcgi_hide_header "Set-Cookie";
36-
}
28+
location ~ /\.(?!well-known\/) {
29+
deny all;
30+
return 404;
31+
}
32+
33+
location /core/ {
34+
deny all;
35+
return 404;
3736
}
37+
3838
location @rewrite {
3939
rewrite ^/(.*)$ /index.php?q=$1;
4040
}
4141

42-
location ~ \.php$ {
43-
try_files $uri =404;
44-
fastcgi_pass %backend_lsnr%;
45-
fastcgi_index index.php;
46-
fastcgi_param SCRIPT_FILENAME $request_filename;
47-
include /etc/nginx/fastcgi_params;
48-
include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
42+
location / {
43+
try_files $uri $uri/ @rewrite;
44+
location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
45+
expires 30d;
46+
fastcgi_hide_header "Set-Cookie";
47+
}
48+
49+
location ~ [^/]\.php(/|$) {
50+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
51+
try_files $uri =404;
52+
fastcgi_pass %backend_lsnr%;
53+
fastcgi_index index.php;
54+
include /etc/nginx/fastcgi_params;
55+
include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
56+
if ($request_uri ~* "/manager/|index.php") {
57+
set $no_cache 1;
58+
}
59+
if ($http_cookie ~ SESS) {
60+
set $no_cache 1;
61+
}
4962
}
5063

5164
location /error/ {
5265
alias %home%/%user%/web/%domain%/document_errors/;
5366
}
5467

55-
location ~ /\.(?!well-known\/) {
56-
deny all;
57-
return 404;
58-
}
59-
6068
location /vstats/ {
6169
alias %home%/%user%/web/%domain%/stats/;
6270
include %home%/%user%/web/%domain%/stats/auth.conf*;
6371
}
6472

65-
include /etc/nginx/conf.d/phpmyadmin.inc*;
66-
include /etc/nginx/conf.d/phppgadmin.inc*;
67-
include %home%/%user%/conf/web/%domain%/nginx.conf_*;
73+
include /etc/nginx/conf.d/phpmyadmin.inc*;
74+
include /etc/nginx/conf.d/phppgadmin.inc*;
75+
include %home%/%user%/conf/web/%domain%/nginx.conf_*;
6876
}

0 commit comments

Comments
 (0)