Skip to content

Commit 6f149e6

Browse files
author
Alexandros Ioannides
authored
Update modx.stpl
1 parent 340add2 commit 6f149e6

File tree

1 file changed

+32
-25
lines changed
  • install/deb/templates/web/nginx/php-fpm

1 file changed

+32
-25
lines changed

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

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ server {
1919

2020
include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;
2121

22-
# if you need to rewrite www to non-www uncomment bellow
23-
# if ($host != '%domain%' ) {
24-
# rewrite ^/(.*)$ https://%domain%/$1 permanent;
25-
# }
2622
location = /favicon.ico {
2723
log_not_found off;
2824
access_log off;
@@ -34,41 +30,52 @@ server {
3430
access_log off;
3531
}
3632

37-
location / {
38-
try_files $uri $uri/ @rewrite;
39-
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
40-
expires max;
41-
fastcgi_hide_header "Set-Cookie";
42-
}
33+
location ~ /\.(?!well-known\/) {
34+
deny all;
35+
return 404;
4336
}
37+
38+
location /core/ {
39+
deny all;
40+
return 404;
41+
}
42+
4443
location @rewrite {
4544
rewrite ^/(.*)$ /index.php?q=$1;
4645
}
4746

48-
location ~ \.php$ {
49-
try_files $uri =404;
50-
fastcgi_pass %backend_lsnr%;
51-
fastcgi_index index.php;
52-
fastcgi_param SCRIPT_FILENAME $request_filename;
53-
include /etc/nginx/fastcgi_params;
54-
include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
47+
location / {
48+
try_files $uri $uri/ @rewrite;
49+
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)$ {
50+
expires 30d;
51+
fastcgi_hide_header "Set-Cookie";
52+
}
53+
54+
location ~ [^/]\.php(/|$) {
55+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
56+
try_files $uri =404;
57+
fastcgi_pass %backend_lsnr%;
58+
fastcgi_index index.php;
59+
include /etc/nginx/fastcgi_params;
60+
include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
61+
if ($request_uri ~* "/manager/|index.php") {
62+
set $no_cache 1;
63+
}
64+
if ($http_cookie ~ SESS) {
65+
set $no_cache 1;
66+
}
5567
}
5668

5769
location /error/ {
5870
alias %home%/%user%/web/%domain%/document_errors/;
5971
}
6072

61-
location ~ /\.(?!well-known\/) {
62-
deny all;
63-
return 404;
64-
}
65-
6673
location /vstats/ {
6774
alias %home%/%user%/web/%domain%/stats/;
6875
include %home%/%user%/web/%domain%/stats/auth.conf*;
6976
}
7077

71-
include /etc/nginx/conf.d/phpmyadmin.inc*;
72-
include /etc/nginx/conf.d/phppgadmin.inc*;
73-
include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
78+
include /etc/nginx/conf.d/phpmyadmin.inc*;
79+
include /etc/nginx/conf.d/phppgadmin.inc*;
80+
include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
7481
}

0 commit comments

Comments
 (0)