Nginx Server - OtagoPolytechnic/op-mattermost GitHub Wiki

Set up Nginx Server

Install Nginx on Ubuntu by using the following command.

sudo apt-get install Nginx

After Install the Nginx. Verify the Nginx is running.

curl http://10.10.10.3
    • You should be able to see a page with Welcome to NGINX!

You can also manage the Nginx by using the following command.

sudo service nginx stop
sudo service nginx start
sudo service nginx restart

Configure the Nginx to the proxy connection from the internet to the Mattermost server.

  • Create a configuration file for the Mattermost

    sudo touch /etc/nginx/sites-available/mattermost

  • Go to the following link here and copy the Nginx script to the file

Remove the existing file by using the following command.

sudo rm /etc/nginx/sites-enabled/default

Link the Mattermost config file by using the following command.

sudo ln -/etc/nginx/sites-available/mattermost /etc/nginx/sites-enabled/mattermost

Restart the Nginx server by using the following command.

sudo service nginx restart

To verify you can see the Mattermost running thru the proxy by using the following command.

  • curl localhost

  • You should be able to see a page with Mattermost – Signup

Setup the Nginx with SSL

To install the let’s encrypt using the following command.

git clone https://github.com/letsencrypt/letsencrypt

Make sure that port 80 is not use by anything, also stop the Nginx server.

sudo service nginx stop
netstat -na | grep ':80.*LISTEN'
./letsencrypt-auto certonly –standalone

Modify the file at /etc/Nginx/sites-available/mattermost.

Copy and add the Nginx config to the file from the following link here.

Restart the Nginx server by using the following command.

sudo service nginx start

Add the following line to corn so the certificate will renew itself every month.

crontab –e
@monthly /home/ubuntu/letsencrypt/letsencrypt-auto certonly --reinstall -d yourdomainname && sudo service nginx reload
⚠️ **GitHub.com Fallback** ⚠️