diff --git a/actions/xmpp b/actions/xmpp
index d657f5b91..eadf8831f 100755
--- a/actions/xmpp
+++ b/actions/xmpp
@@ -47,6 +47,9 @@ def parse_arguments():
'--domainname',
help='The domain name that will be used by the XMPP service.')
+ # Setup jwchat apache conf
+ subparsers.add_parser('setup', help='Setup jwchat apache conf')
+
# Prepare ejabberd for hostname change
pre_hostname_change = subparsers.add_parser(
'pre-change-hostname',
@@ -103,6 +106,13 @@ def subcommand_pre_install(arguments):
input=b'jwchat jwchat/ApacheServerName string ' + domainname.encode())
+def subcommand_setup(_):
+ """Setup jwchat apache conf"""
+ subprocess.call(['a2dissite', 'jwchat'])
+ subprocess.call(['a2enconf', 'jwchat-plinth'])
+ subprocess.call(['service', 'apache2', 'reload'])
+
+
def subcommand_pre_change_hostname(arguments):
"""Prepare ejabberd for hostname change"""
old_hostname = arguments.old_hostname
diff --git a/data/etc/apache2/conf-available/jwchat-plinth.conf b/data/etc/apache2/conf-available/jwchat-plinth.conf
new file mode 100644
index 000000000..8f98e2f94
--- /dev/null
+++ b/data/etc/apache2/conf-available/jwchat-plinth.conf
@@ -0,0 +1,12 @@
+Alias /jwchat /usr/share/jwchat/www
+
+
+ Options +Indexes +Multiviews +FollowSymLinks
+
+
+# proxy for BOSH server
+ProxyPass /http-bind/ http://localhost:5280/http-bind/
+ProxyPassReverse /http-bind/ http://localhost:5280/http-bind/
+
+ Allow from all
+
diff --git a/plinth/modules/xmpp/xmpp.py b/plinth/modules/xmpp/xmpp.py
index 90c88b541..2fca388cf 100644
--- a/plinth/modules/xmpp/xmpp.py
+++ b/plinth/modules/xmpp/xmpp.py
@@ -70,9 +70,15 @@ def before_install():
actions.superuser_run('xmpp', ['pre-install', '--domainname', domainname])
+def on_install():
+ """Setup jwchat apache conf"""
+ actions.superuser_run('xmpp', ['setup'])
+
+
@login_required
@package.required(['jwchat', 'ejabberd'],
- before_install=before_install)
+ before_install=before_install,
+ on_install=on_install)
def index(request):
"""Serve XMPP page"""
return TemplateResponse(request, 'xmpp.html',