Browse Source

Update nginx configuration, templates, and file permissions for default page template

* Change permissions on index.html
* Update web_system.stpl
* Update web_system.tpl
* Update default.tpl
* Update default.stpl
* Error codes
* Update nginx.conf
Alexandros Ioannides 6 years ago
parent
commit
556dfae3d0

+ 5 - 5
install/deb/nginx/nginx.conf

@@ -121,9 +121,9 @@ http {
     add_header          X-Content-Type-Options nosniff;
 
     # Error pages
-    error_page          403          /error/403.html;
-    error_page          404          /error/404.html;
-    error_page          502 503 504  /error/50x.html;
+    error_page 403 /error/404.html;
+    error_page 404 /error/404.html;
+    error_page 500 501 502 503 504 505 /error/50x.html;
 
     # Cache settings
     proxy_cache_path /var/cache/nginx levels=2 keys_zone=cache:10m inactive=60m max_size=1024m;
@@ -147,6 +147,6 @@ http {
     open_file_cache_errors   off;
 
     # Wildcard include
-    include             /etc/nginx/conf.d/*.conf;
-    include             /etc/nginx/conf.d/domains/*.conf;
+    include /etc/nginx/conf.d/*.conf;
+    include /etc/nginx/conf.d/domains/*.conf;
 }

+ 8 - 8
install/deb/templates/mail/nginx/default.stpl

@@ -20,20 +20,20 @@ server {
 
     location / {
         proxy_pass https://%ip%:%web_ssl_port%;
-        try_files $uri $uri/ /index.php?q=$uri&$args;
+        try_files $uri $uri/ =404;
         alias /var/lib/roundcube/;
         location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
             expires 7d;
             fastcgi_hide_header "Set-Cookie";
         }
-    }
 
-    location ~ ^/(.*\.php)$ {
-        alias /var/lib/roundcube/$1;
-        fastcgi_pass 127.0.0.1:9000;
-        fastcgi_index index.php;
-        include fastcgi_params;
-        fastcgi_param SCRIPT_FILENAME $request_filename;
+        location ~ ^/(.*\.php)$ {
+            alias /var/lib/roundcube/$1;
+            fastcgi_pass 127.0.0.1:9000;
+            fastcgi_index index.php;
+            include fastcgi_params;
+            fastcgi_param SCRIPT_FILENAME $request_filename;
+        }
     }
 
     error_page 403 /error/404.html;

+ 8 - 8
install/deb/templates/mail/nginx/default.tpl

@@ -20,20 +20,20 @@ server {
 
     location / {
         proxy_pass http://%ip%:%web_port%;
-        try_files $uri $uri/ /index.php?q=$uri&$args;
+        try_files $uri $uri/ =404;
         alias /var/lib/roundcube/;
         location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
             expires 7d;
             fastcgi_hide_header "Set-Cookie";
         }
-    }
 
-    location ~ ^/(.*\.php)$ {
-        alias /var/lib/roundcube/$1;
-        fastcgi_pass 127.0.0.1:9000;
-        fastcgi_index index.php;
-        include fastcgi_params;
-        fastcgi_param SCRIPT_FILENAME $request_filename;
+        location ~ ^/(.*\.php)$ {
+            alias /var/lib/roundcube/$1;
+            fastcgi_pass 127.0.0.1:9000;
+            fastcgi_index index.php;
+            include fastcgi_params;
+            fastcgi_param SCRIPT_FILENAME $request_filename;
+        }
     }
 
     error_page 403 /error/404.html;

+ 8 - 8
install/deb/templates/mail/nginx/web_system.stpl

@@ -19,19 +19,19 @@ server {
     }
 
     location / {
-        try_files $uri $uri/ /index.php?q=$uri&$args;
+        try_files $uri $uri/ =404;
         location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
             expires 7d;
             fastcgi_hide_header "Set-Cookie";
         }
-    }
 
-    location ~ ^/(.*\.php)$ {
-        alias /var/lib/roundcube/$1;
-        fastcgi_pass 127.0.0.1:9000;
-        fastcgi_index index.php;
-        include fastcgi_params;
-        fastcgi_param SCRIPT_FILENAME $request_filename;
+        location ~ ^/(.*\.php)$ {
+            alias /var/lib/roundcube/$1;
+            fastcgi_pass 127.0.0.1:9000;
+            fastcgi_index index.php;
+            include fastcgi_params;
+            fastcgi_param SCRIPT_FILENAME $request_filename;
+        }
     }
 
     error_page 403 /error/404.html;

+ 8 - 8
install/deb/templates/mail/nginx/web_system.tpl

@@ -19,19 +19,19 @@ server {
     }
 
     location / {
-        try_files $uri $uri/ /index.php?q=$uri&$args;
+        try_files $uri $uri/ =404;
         location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
             expires 7d;
             fastcgi_hide_header "Set-Cookie";
         }
-    }
 
-    location ~ ^/(.*\.php)$ {
-        alias /var/lib/roundcube/$1;
-        fastcgi_pass 127.0.0.1:9000;
-        fastcgi_index index.php;
-        include fastcgi_params;
-        fastcgi_param SCRIPT_FILENAME $request_filename;
+        location ~ ^/(.*\.php)$ {
+            alias /var/lib/roundcube/$1;
+            fastcgi_pass 127.0.0.1:9000;
+            fastcgi_index index.php;
+            include fastcgi_params;
+            fastcgi_param SCRIPT_FILENAME $request_filename;
+        }
     }
 
     error_page 403 /error/404.html;

+ 1 - 0
install/hst-install-ubuntu.sh

@@ -1044,6 +1044,7 @@ chmod 751 $HESTIA/data/templates/web/suspend/webfonts
 chmod 751 $HESTIA/data/templates/web/unassigned/css
 chmod 751 $HESTIA/data/templates/web/unassigned/js
 chmod 751 $HESTIA/data/templates/web/unassigned/webfonts
+chmod 644 $HESTIA/data/templates/web/unassigned/index.html
 
 mkdir -p /var/www/html
 

+ 3 - 3
src/deb/nginx/nginx.conf

@@ -102,9 +102,9 @@ http {
         ssl_certificate      /usr/local/hestia/ssl/certificate.crt;
         ssl_certificate_key  /usr/local/hestia/ssl/certificate.key;
 
-        error_page      404     /error/404/index.html;
-        error_page      403     /error/index.html;
-        error_page      500     /error/index.html;
+        error_page 403 /error/404/index.html;
+        error_page 404 /error/404/index.html;
+        error_page 500 501 502 503 504 505 /error/index.html;
 
         location / {
             expires off;