Quantcast
Channel: Mattermost Discussion Forums - Latest posts
Viewing all articles
Browse latest Browse all 25778

Mattermost Apache Configuration

$
0
0

Hi @shieldsjared, here is the complete piece of code to make mattermost properly run under Apache.
The easiest solution is to add the following code directly into the /etc/apache2/apache2.conf file.
For this configuration to work, you need to create a subdomain and make sure that it points to the correct IP address. You usually do this easily under the settings of your domain name registrar.
Let's say you want Mattermost to run under https://mattermost.domain.com

<VirtualHost *:80>
    ServerName mattermost.domain.com
    Redirect / https://mattermost.domain.com/
</VirtualHost>

<VirtualHost *:443>
    ServerName mattermost.domain.com
    SSLEngine on
    SSLCertificateKeyFile  pathto/mattermost.key
    SSLCertificateFile pathto/mattermost.crt

    ProxyPreserveHost On
    ProxyRequests Off
    ProxyPass / http://127.0.0.1:8065/
    ProxyPassReverse / http://127.0.0.1:8065/

    RewriteEngine on
    RewriteCond %{REQUEST_URI} ^/api/v1/websocket [NC,OR]
    RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC,OR]
    RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
    RewriteRule .* ws://127.0.0.1:8065%{REQUEST_URI} [P,QSA,L]
    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
    RewriteRule .* http://127.0.0.1:8065%{REQUEST_URI} [P,QSA,L]

    <Location /api/v1/websocket>
        Require all granted
        ProxyPassReverse http://127.0.0.1:8065
        ProxyPassReverseCookieDomain 127.0.0.1 mattermost.domain.com
    </Location>
    <Location />
        Require all granted
        ProxyPassReverse http://127.0.0.1:8065
        ProxyPassReverseCookieDomain 127.0.0.1 mattermost.domain.com
    </Location>
    ErrorLog ${APACHE_LOG_DIR}/error_mattermost.log
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/access_mattermost.log combine
</VirtualHost>

With this example, the user is automatically redirect to https.
I hope that helps. I am not an expert so if anybody sees something weird somewhere, please let me know :slight_smile:
Don't forget to restart apache.
Enjoy.


Viewing all articles
Browse latest Browse all 25778

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>