Alexandros Ioannides 5 лет назад
Родитель
Сommit
6f149e625b
1 измененных файлов с 32 добавлено и 25 удалено
  1. 32 25
      install/deb/templates/web/nginx/php-fpm/modx.stpl

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

@@ -19,10 +19,6 @@ server {
 
 
     include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;
     include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;
 
 
-#   if you need to rewrite www to non-www uncomment bellow
-#   if ($host != '%domain%' ) {
-#       rewrite      ^/(.*)$  https://%domain%/$1  permanent;
-#    }
     location = /favicon.ico {
     location = /favicon.ico {
         log_not_found off;
         log_not_found off;
         access_log off;
         access_log off;
@@ -34,41 +30,52 @@ server {
         access_log off;
         access_log off;
     }
     }
 
 
-    location / {
-        try_files $uri $uri/ @rewrite;
-        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
-            expires     max;
-            fastcgi_hide_header "Set-Cookie";
-        }
+    location ~ /\.(?!well-known\/) {
+        deny all;
+        return 404;
     }
     }
+
+    location /core/ {
+        deny all;
+        return 404;
+    }
+
     location @rewrite {
     location @rewrite {
         rewrite ^/(.*)$ /index.php?q=$1;
         rewrite ^/(.*)$ /index.php?q=$1;
     }
     }
 
 
-    location ~ \.php$ {
-        try_files $uri =404;
-        fastcgi_pass %backend_lsnr%;
-        fastcgi_index index.php;
-        fastcgi_param SCRIPT_FILENAME $request_filename;
-        include /etc/nginx/fastcgi_params;
-        include     %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
+    location / {
+        try_files $uri $uri/ @rewrite;
+        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)$ {
+            expires 30d;
+            fastcgi_hide_header "Set-Cookie";
+        }
+
+        location ~ [^/]\.php(/|$) {
+            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+            try_files $uri =404;
+            fastcgi_pass %backend_lsnr%;
+            fastcgi_index index.php;
+            include /etc/nginx/fastcgi_params;
+            include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
+                if ($request_uri ~* "/manager/|index.php") {
+                    set $no_cache 1;
+                }
+                if ($http_cookie ~ SESS) {
+                    set $no_cache 1;
+                }
     }
     }
 
 
     location /error/ {
     location /error/ {
         alias   %home%/%user%/web/%domain%/document_errors/;
         alias   %home%/%user%/web/%domain%/document_errors/;
     }
     }
 
 
-    location ~ /\.(?!well-known\/) { 
-       deny all; 
-       return 404;
-    }
-
     location /vstats/ {
     location /vstats/ {
         alias   %home%/%user%/web/%domain%/stats/;
         alias   %home%/%user%/web/%domain%/stats/;
         include %home%/%user%/web/%domain%/stats/auth.conf*;
         include %home%/%user%/web/%domain%/stats/auth.conf*;
     }
     }
 
 
-    include     /etc/nginx/conf.d/phpmyadmin.inc*;
-    include     /etc/nginx/conf.d/phppgadmin.inc*;
-    include     %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
+    include /etc/nginx/conf.d/phpmyadmin.inc*;
+    include /etc/nginx/conf.d/phppgadmin.inc*;
+    include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
 }
 }