Sfoglia il codice sorgente

[Web] Remove XMPP site when disabling XMPP

andryyy 4 anni fa
parent
commit
666d344322

+ 8 - 0
data/conf/nginx/includes/site-defaults.conf

@@ -116,6 +116,14 @@
     proxy_redirect off;
     proxy_redirect off;
   }
   }
 
 
+  location /xmpp/ {
+    proxy_pass       http://ejabberd:5282/xmpp/;
+    proxy_set_header Host      $http_host;
+    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+    proxy_set_header X-Real-IP $remote_addr;
+    proxy_redirect off;
+  }
+
   location ~* ^/Autodiscover/Autodiscover.xml {
   location ~* ^/Autodiscover/Autodiscover.xml {
     fastcgi_split_path_info ^(.+\.php)(/.+)$;
     fastcgi_split_path_info ^(.+\.php)(/.+)$;
     fastcgi_pass phpfpm:9002;
     fastcgi_pass phpfpm:9002;

+ 8 - 0
data/web/inc/functions.xmpp.inc.php

@@ -235,6 +235,14 @@ EOF;
       }
       }
       fwrite($acl_handle, '# Autogenerated by mailcow' . PHP_EOL);
       fwrite($acl_handle, '# Autogenerated by mailcow' . PHP_EOL);
       fclose($acl_handle);
       fclose($acl_handle);
+
+      // Write empty Nginx site
+      $acl_handle = fopen('/etc/nginx/conf.d/ZZZ-ejabberd.conf', 'w');
+      if (!$acl_handle) {
+        throw new Exception($lang['danger']['file_open_error']);
+      }
+      fwrite($acl_handle, '# Autogenerated by mailcow' . PHP_EOL);
+      fclose($acl_handle);
     }
     }
 
 
     if (md5_file('/ejabberd/ejabberd_acl.yml') != $ejabberd_acl_md5) {
     if (md5_file('/ejabberd/ejabberd_acl.yml') != $ejabberd_acl_md5) {