Mattermost with ISPConfig3 and Ubuntu 20.04
Mattermost is an open-source alternative to slack, like Gitlab to Github. Since we wanted to use our IRC to communicate about development tasks and be a channel for automated messages, 90 days of retention for the free slack account seemed too short. Plus we are here to learn and what better way?
Initially, we tried the dockerised version but very quickly found stability issues due to how our backups were running. The connection via our HA Proxy also added an additional layer of complication so we decided to simplify things.
Our Infrastructure
For this part of the infrastructure, we are rocking OpnSense for the router/firewall with a HA Proxy server behind routing traffic to the appropriate web node. For the database, we have gone with MariaDB 10.5 which isn’t strictly supported by MatterMost but we haven’t had an issue so far.
There is nothing special about the HA Proxy setup other than it handles the SSL certificate setup and transfers a copy to the Webnode. Traffic is sent on the standard 443 port and HTTP is redirected to HTTPS as standard.

Setup ISPConfig3
Create the new site as normal using your preferred PHP version.

Note: In ours, we are not ticking Let’s Encrypt because we handle this at the HA Proxy layer and overwrite the manually generated certs in the file system.
Part 2: Add the additional apache config from here to the options tab > Apache Directives.
ServerName chat.replace_me.com
ProxyPreserveHost On
RewriteEngine On
RewriteCond %{REQUEST_URI} /api/v[0-9]+/(users/)?websocket [NC]
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC,OR]
RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
RewriteRule .* ws://127.0.0.1:8065%{REQUEST_URI} [P,QSA,L]
# change to wss for ssl
# RewriteRule .* wss://127.0.0.1:8065%{REQUEST_URI} [P,QSA,L]
<Location />
Require all granted
ProxyPass http://127.0.0.1:8065/
ProxyPassReverse http://127.0.0.1:8065/
ProxyPassReverseCookieDomain 127.0.0.1 chat.replace_me.com
</Location>
Remember to make sure you’ve set up the Apache2 Modules.
Installing on Ubuntu
This followed the standard install from here with the following amendments:
- We are using a MySQL flavour not PostgreSQL so be sure to follow the MySQL steps
- When you get to the Systemd file you’ll need to specify
mariadb.service
instead ofmysql.service
For our installation, we have LetsEncrypt running on the HA Proxy as an included service so we simply copy the certs into place.
You should now have something like so…

- Apache configuration:
/etc/apache2/sites-enabled/100-your.site.com
- The log files for apache will be located:
/var/www/your.site.com/logs/
- The log files for apache will be located:
- MatterMost configuration:
/opt/mattermost/config/config.json
- The logs for MatterMost:
/opt/mattermost/logs/
- The logs for MatterMost:
Summary
Setting this up and installing natively on Ubuntu was quite straightforward. The documentation supplied by MatterMost is well-maintained with good community backing.
Adding in the extra bits for ISPConfig3 was relatively straight forward but I would still recommend purchasing the manual as this provides lots of insights into how to correctly configure stuff.