Mattermost installation with Apache redirection on Ubuntu 16.04

Mattermost is an open-source alternative to slack. It is easily installed on Ubuntu 16.04 LTS but apache2 configuration needs tricking a bit to set up SSL encryption properly. Here is my solution.

  1. Step 1: Mattermost installation is well described at this link. I have installed it with a mysql database and I simply followed the instructions described in sections
    1. Installing Ubuntu Server 16.04 LTS
    2. Installing MySQL Database Server
    3. Installing Mattermost Server
  2. Step 2: At this step, to properly run mattermost, I needed to open the proper tcp port (8065) for shorewall. This was performed by editing (as root) the file /etc/shorewall/rules and adding the line
    ACCEPT          net             $FW             tcp     8065

    shorewall then needs a restart with

    sudo service shorewall restart

    mattermost can be started with

    sudo service mattermost start

    At this step, you should have access to mattermost at http://your-domain.org:3065. You can create a first user that will be the administrator (choose a strong password for that user).

  3. Step 3: Configuring the apache2 redirection with a proper SSL encryption is performed as follows:
    1. first, the following apache2 modules must be enabled: ssl, proxy, proxy_http, proxy_wstunnel. You can load then using the following command lines:
      sudo a2enmod ssl proxy proxy_http proxy_wstunnel
      sudo service apache2 reload
      
    2. second, create the virtual user in /etc/apache2/sites-available/mattermost.conf as follows:
      mattermost-vhost.png
      where the SSL certificates are created as described in this previous post. Finally, enable its use with

      sudo a2ensite mattermost
      sudo service apache2 reload
      

      mattermost can be accessed at https://mattermost.my-domain.org and you can proceed with the mattermost configuration as described in Configuring Mattermost Server.