You want to self host mattermost on your own server, run mattermost under http:// with simple docker command, then put it behind Nginx.
Solution
You need to build the docker image and run it yourself. Assume you are at the /home/project folder:
1, Clone repo and config env:
1 2 3 4 5
git clone https://github.com/mattermost/docker mv docker mattermost # now our root folder is /home/project/mattermost mkdir logs # for later config nginx mkdir static # for later config nginx cp env.example .env
Now open the .env file, at the first line, change DOMAIN to your own domain that you want to host mattermost, like mm.yourdomain.com (there are other configs but for minimal configuration, you don’t need to change them).
2, Create the required directories and set their permissions.
3, Since we are going to run mattermost just under http://, then use https in Nginx, nginx will proxy to mattermost’s http server, we don’t need to config the https cert for mattermost server, just need to do that in Nginx layer.
Now we can just do docker-compose and run, if docker-compose is not found, make sure install it first:
1 2
su apt install docker-compose
Now we can create 2 scripts to start and stop the server:
1 ) start.sh
1 2
#!/usr/bin/env bash docker-compose -f docker-compose.yml -f docker-compose.without-nginx.yml up -d
2 ) stop.sh
1 2
#!/usr/bin/env bash docker-compose -f docker-compose.yml -f docker-compose.without-nginx.yml down
4, To start the service, just run start.sh, to stop it, use stop.sh. After run start.sh, now the mattermost server should be running at http://127.0.0.1:8065. You can use docker ps to confirm the docker image is running, like:
1 2
CONTAINER ID IMAGE COMMAND 80780ddaea53 mattermost/mattermost-enterprise-edition:7.1 "/entrypoint.sh matt…"
All done! Restart Nginx, now you can go to https://mm.yourdomain.com to use mattermost. P.S, if you want to turn on notification, you need to go to go to System Console > Environment > Push Notification Server > Enable Push Notifications, then select Use TPNS connection to send notifications to iOS and Android apps.