Skip to content

Commit 07a18a5

Browse files
committed
Further revisions and updates
1 parent a1a77c2 commit 07a18a5

10 files changed

+224
-133
lines changed

source/install/config-mattermost.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _config-mattermost:
2+
13
======================
24
Configuring Mattermost
35
======================
@@ -10,4 +12,5 @@ After installing the Mattermost components, you must create the first user and f
1012

1113
.. include:: config-mattermost-server.rst
1214
.. include:: config-tls-mattermost.rst
15+
.. include:: config-proxy-nginx.rst
1316
.. include:: config-ssl-http2-nginx.rst
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
.. _config-proxy-nginx:
2+
3+
Configuring NGINX as a proxy for Mattermost Server
4+
==================================================
5+
6+
**To configure NGINX as a proxy**
7+
8+
1. Log into the server that hosts NGINX and open a terminal window.
9+
2. Create a configuration file for Mattermost.
10+
11+
``sudo touch /etc/nginx/sites-available/mattermost``
12+
13+
2. Open the file ``/etc/nginx/sites-available/mattermost`` as root in a text editor and replace its contents, if any, with the following lines. Make sure that you use your own values for the Mattermost server IP address and FQDN for *server_name*.
14+
15+
.. code-block:: none
16+
17+
upstream backend {
18+
server 10.10.10.2:8065;
19+
}
20+
21+
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=mattermost_cache:10m max_size=3g inactive=120m use_temp_path=off;
22+
23+
server {
24+
listen 80;
25+
server_name mattermost.example.com;
26+
27+
location /api/v3/users/websocket {
28+
proxy_set_header Upgrade $http_upgrade;
29+
proxy_set_header Connection "upgrade";
30+
client_max_body_size 50M;
31+
proxy_set_header Host $http_host;
32+
proxy_set_header X-Real-IP $remote_addr;
33+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
34+
proxy_set_header X-Forwarded-Proto $scheme;
35+
proxy_set_header X-Frame-Options SAMEORIGIN;
36+
proxy_buffers 256 16k;
37+
proxy_buffer_size 16k;
38+
proxy_read_timeout 600s;
39+
proxy_pass http://backend;
40+
}
41+
42+
location / {
43+
client_max_body_size 50M;
44+
proxy_set_header Connection "";
45+
proxy_set_header Host $http_host;
46+
proxy_set_header X-Real-IP $remote_addr;
47+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
48+
proxy_set_header X-Forwarded-Proto $scheme;
49+
proxy_set_header X-Frame-Options SAMEORIGIN;
50+
proxy_buffers 256 16k;
51+
proxy_buffer_size 16k;
52+
proxy_read_timeout 600s;
53+
proxy_cache mattermost_cache;
54+
proxy_cache_revalidate on;
55+
proxy_cache_min_uses 2;
56+
proxy_cache_use_stale timeout;
57+
proxy_cache_lock on;
58+
proxy_pass http://backend;
59+
}
60+
}
61+
62+
3. Remove the existing default sites-enabled file.
63+
64+
``sudo rm /etc/nginx/sites-enabled/default``
65+
66+
4. Enable the mattermost configuration.
67+
68+
``sudo ln -s /etc/nginx/sites-available/mattermost /etc/nginx/sites-enabled/mattermost``
69+
70+
5. Restart NGINX.
71+
72+
``sudo service nginx restart``
73+
74+
6. Verify you can see Mattermost thru the proxy.
75+
76+
``curl http://localhost``
77+
78+
If everything is working, you will see the HTML for the Mattermost signup page.
79+
80+
**What to do next**
81+
82+
You can configure NGINX to use SSL. This will allow you to use HTTPS connections and the HTTP/2 protocol.
83+
84+
**Related links**
85+
- :ref:`config-ssl-http2-nginx`

source/install/config-ssl-http2-nginx.rst

Lines changed: 45 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,44 @@
1+
.. _config-ssl-http2-nginx:
2+
13
Configuring NGINX with SSL and HTTP/2
24
=====================================
35

4-
1. You can use a free and an open certificate security like let's
5-
encrypt, this is how to proceed
6+
Using SSL gives greater security by ensuring that communications between Mattermost clients and the Mattermost server are encrypted. It also allows you to configure NGINX to use the HTTP/2 protocol.
7+
8+
Although you can configure HTTP/2 without SSL, both Firefox and Chrome browsers support HTTP/2 on secure connections only.
9+
10+
You can use any certificate that you want, but these instructions show you how to download and install certificates from *Let's Encrypt*.
11+
12+
1. Log into the server that hosts NGINX and open a terminal window.
13+
2. Install git.
14+
15+
``sudo apt-get install git``
16+
17+
3. Clone the Let's Encrypt repository on GitHub.
18+
19+
``git clone https://github.com/letsencrypt/letsencrypt``
20+
21+
4. Change to the ``letsencrypt`` directory.
622

7-
- ``sudo apt-get install git``
8-
- ``git clone https://github.com/letsencrypt/letsencrypt``
9-
- ``cd letsencrypt``
23+
``cd letsencrypt``
1024

11-
2. Be sure that the port 80 is not use by stopping NGINX
25+
5. Stop NGINX.
1226

13-
- ``sudo service nginx stop``
14-
- ``netstat -na | grep ':80.*LISTEN'``
15-
- ``./letsencrypt-auto certonly --standalone``
27+
``sudo service nginx stop``
1628

17-
3. This command will download packages and run the instance, after that
18-
you will have to give your domain name
19-
4. You can find your certificate in ``/etc/letsencrypt/live``
20-
5. Modify the file at ``/etc/nginx/sites-available/mattermost`` and add
21-
the following lines:
29+
6. Run ``netstat`` to make sure that nothing is listening on port 80.
2230

23-
::
31+
``netstat -na | grep ':80.*LISTEN'``
32+
33+
7. Run the Let's Encrypt installer.
34+
35+
``./letsencrypt-auto certonly --standalone``
36+
37+
When prompted, enter your domain name. The certificate is located in ``/etc/letsencrypt/live``
38+
39+
8. Open the file ``/etc/nginx/sites-available/mattermost`` as root and update it to incorporate the following lines. Make sure that you use your own values for the Mattermost server IP address and FQDN for *server_name*.
40+
41+
.. code-block:: none
2442
2543
upstream backend {
2644
server 10.10.10.2:8065;
@@ -35,7 +53,7 @@ Configuring NGINX with SSL and HTTP/2
3553
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=mattermost_cache:10m max_size=3g inactive=120m use_temp_path=off;
3654
3755
server {
38-
listen 443 ssl;
56+
listen 443 ssl http2;
3957
server_name mattermost.example.com;
4058
4159
ssl on;
@@ -85,23 +103,19 @@ Configuring NGINX with SSL and HTTP/2
85103
}
86104
87105
88-
6. Be sure to restart NGINX
89-
* ``\ sudo service nginx start``
90-
7. Add the following line to cron so the cert will renew every month
91-
* ``crontab -e``
92-
* ``@monthly /home/ubuntu/letsencrypt/letsencrypt-auto certonly --reinstall --nginx -d yourdomainname && sudo service nginx reload``
93-
8. Check that your SSL certificate is set up correctly
94-
* Test the SSL certificate by visiting a site such as `https://www.ssllabs.com/ssltest/index.html <https://www.ssllabs.com/ssltest/index.html>`_
95-
* If there’s an error about the missing chain or certificate path, there is likely an intermediate certificate missing that needs to be included
106+
9. Restart NGINX
107+
108+
``sudo service nginx start``
96109

97-
Setup HTTP2
98-
------------
110+
10. Check that your SSL certificate is set up correctly.
99111

100-
It is recommended to enable HTTP2 for enhanced performance.
112+
* Test the SSL certificate by visiting a site such as https://www.ssllabs.com/ssltest/index.html
113+
* If there’s an error about the missing chain or certificate path, there is likely an intermediate certificate missing that needs to be included.
101114

102-
1. Modify your NGINX configuration as above. Then,
115+
11. Configure ``cron`` so that the certificate will automatically renew every month.
103116

104-
- Change the line ``listen 443 ssl;`` to ``listen 443 ssl http2;``
105-
- Change the line ``proxy_pass http://10.10.10.2:8065;`` to ``proxy_pass https://10.10.10.2:8065;``
117+
``crontab -e``
118+
119+
In the following line, use your domain name in place of *<domain-name>*
106120

107-
2. Restart NGINX
121+
``@monthly /home/ubuntu/letsencrypt/letsencrypt-auto certonly --reinstall --nginx -d <domain-name> && sudo service nginx reload``

source/install/install-common-intro.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ A complete Mattermost installation consists of 3 major components: a proxy serve
22

33
The Mattermost server must be installed on a 64-bit machine, but the database and proxy can be on 32-bit machines. For the database, you can install either MySQL or ProstgreSQL. The proxy is NGINX.
44

5-
After all the components are installed, some configuration is required. You can set up email notifications, SSL, TSL, and HTTP/2. For more information about configuring, see
5+
After all the components are installed, some configuration is required. You can set up email notifications, SSL, TSL, and HTTP/2. For more information about configuring, see :ref:`config-mattermost`.

source/install/install-nginx.rst

Lines changed: 47 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _install-nginx:
2+
13
Installing NGINX Server
24
=======================
35

@@ -10,88 +12,50 @@ The main benefits of using a proxy are as follows:
1012
- Port mapping ``:80`` to ``:8065``
1113
- Standard request logs
1214

13-
Assume that the IP address of the proxy server is 10.10.10.3.
14-
1515
**To install NGINX on Ubuntu Server:**
1616

17-
1. Log into the server that will host the proxy and issue the following command:
18-
19-
- ``sudo apt-get install nginx``
20-
21-
2. Verify NGINX is running
22-
23-
- ``curl http://10.10.10.3``
24-
- You should see a *Welcome to NGINX!* page
25-
26-
3. You can manage NGINX with the following commands
27-
28-
- ``sudo service nginx stop``
29-
- ``sudo service nginx start``
30-
- ``sudo service nginx restart``
31-
32-
4. Map a FQDN (fully qualified domain name) like
33-
``mattermost.example.com`` to point to the NGINX server.
34-
5. Configure NGINX to proxy connections from the internet to the
35-
Mattermost Server
36-
37-
- Create a configuration for Mattermost
38-
- ``sudo touch /etc/nginx/sites-available/mattermost``
39-
- Below is a sample nginx configuration optimized for performance:
40-
41-
::
42-
43-
upstream backend {
44-
server 10.10.10.2:8065;
45-
}
46-
47-
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=mattermost_cache:10m max_size=3g inactive=120m use_temp_path=off;
48-
49-
server {
50-
listen 80;
51-
server_name mattermost.example.com;
52-
53-
location /api/v3/users/websocket {
54-
proxy_set_header Upgrade $http_upgrade;
55-
proxy_set_header Connection "upgrade";
56-
client_max_body_size 50M;
57-
proxy_set_header Host $http_host;
58-
proxy_set_header X-Real-IP $remote_addr;
59-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
60-
proxy_set_header X-Forwarded-Proto $scheme;
61-
proxy_set_header X-Frame-Options SAMEORIGIN;
62-
proxy_buffers 256 16k;
63-
proxy_buffer_size 16k;
64-
proxy_read_timeout 600s;
65-
proxy_pass http://backend;
66-
}
67-
68-
location / {
69-
client_max_body_size 50M;
70-
proxy_set_header Connection "";
71-
proxy_set_header Host $http_host;
72-
proxy_set_header X-Real-IP $remote_addr;
73-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
74-
proxy_set_header X-Forwarded-Proto $scheme;
75-
proxy_set_header X-Frame-Options SAMEORIGIN;
76-
proxy_buffers 256 16k;
77-
proxy_buffer_size 16k;
78-
proxy_read_timeout 600s;
79-
proxy_cache mattermost_cache;
80-
proxy_cache_revalidate on;
81-
proxy_cache_min_uses 2;
82-
proxy_cache_use_stale timeout;
83-
proxy_cache_lock on;
84-
proxy_pass http://backend;
85-
}
86-
}
87-
88-
89-
* Remove the existing file with
90-
* ``` sudo rm /etc/nginx/sites-enabled/default```
91-
* Link the mattermost config by typing:
92-
* ```sudo ln -s /etc/nginx/sites-available/mattermost /etc/nginx/sites-enabled/mattermost```
93-
* Restart NGINX by typing:
94-
* ``` sudo service nginx restart```
95-
* Verify you can see Mattermost thru the proxy by typing:
96-
* ``` curl http://localhost```
97-
* You should see a page titles *Mattermost - Signup*
17+
1. Log into the server that will host the proxy and open a terminal window.
18+
2. Make sure that your package index is up to date.
19+
20+
``sudo apt-get update``
21+
22+
3. Install NGINX.
23+
24+
``sudo apt-get install nginx``
25+
26+
4. After the installation is complete, verify that NGINX is running.
27+
28+
``curl http://localhost``
29+
30+
If NGINX is running, you see the following output:
31+
32+
.. code-block:: html
33+
34+
<!DOCTYPE html>
35+
<html>
36+
<head>
37+
<title>Welcome to nginx!</title>
38+
.
39+
.
40+
.
41+
<p><em>Thank you for using nginx.</em></p>
42+
</body>
43+
</html>
44+
45+
.. Note::
46+
47+
You can stop, start, and restart NGINX with the following commands:
48+
49+
.. code-block:: none
50+
51+
sudo service nginx stop
52+
sudo service nginx start
53+
sudo service nginx restart
54+
55+
**What to do next**
56+
57+
1. Map a fully qualified domain name (FQDN) such as ``mattermost.example.com`` to point to the NGINX server.
58+
2. Configure NGINX to proxy connections from the internet to the Mattermost Server.
59+
60+
**Related links**
61+
- :ref:`config-proxy-nginx`

source/install/install-ubuntu-1404-mattermost.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
.. _install-ubuntu-1404-mattermost:
2+
13
Installing Mattermost Server
2-
================================
4+
============================
35

46
Install Mattermost Server on a 64-bit machine.
57

0 commit comments

Comments
 (0)