diff --git a/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/100mailstats b/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/100mailstats
index 3f2d65d..742850c 100644
--- a/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/100mailstats
+++ b/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/100mailstats
@@ -1,17 +1,40 @@
- # Alias for mailstats
- Alias "/mailstats/css" "/opt/mailstats/css"
- Alias "/mailstats" "/opt/mailstats/html"
+{
+# mailstats
+ my $status = $mailstats{'Status'} || 'disabled';
-
- Options Indexes FollowSymLinks
- AllowOverride None
- Require all granted
-
+ if ($status eq 'enabled')
+ {
+ $OUT .="#-------------------------------------------------\n";
+ $OUT .="# mailstats settings from smeserver-mailstats\n";
+ $OUT .="#-------------------------------------------------\n";
+ $OUT .="\n";
+ $OUT .= qq(
+ # Alias for mailstats
+ Alias "/mailstats/css" "/opt/mailstats/css"
+ Alias "/mailstats" "/opt/mailstats/html"
+
+
+ Options Indexes FollowSymLinks
+ AllowOverride None
+ Require all granted
+ );
+ $OUT .= (($mailstats{access} || 'private' ) eq "public" ) ? " Require all granted": " Require ip $localAccess $externalSSLAccess";
+ $OUT .= qq(
+
SetHandler "proxy:unix:/var/run/php-fpm/php74.sock|fcgi://localhost"
-
+
+
+
+ AllowOverride None
+ Require all granted
+
+ );
+
+ }
+ else
+ {
+ $OUT .= "# mailstats is disabled";
+ }
+}
-
- AllowOverride None
- Require all granted
-