Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

docs: Add Apache2 reverse proxy instructions and example.

qnxor6399bccc0759
diff --git a/docs/production/deployment.md b/docs/production/deployment.md
index e413a672944..7385ab930b6 100644
--- a/docs/production/deployment.md
+++ b/docs/production/deployment.md
@@ -257,6 +257,65 @@ your installation.
[zulipchat-puppet]: https://github.com/zulip/zulip/tree/master/puppet/zulip_ops/manifests
[nginx-loadbalancer]: https://github.com/zulip/zulip/blob/master/puppet/zulip_ops/files/nginx/sites-available/loadbalancer
+### Apache2 configuration
+
+Below is a working example of a full Apache2 configuration. It assumes
+that your Zulip sits at `http://localhost:5080`. You first need to
+make the following changes in two configuration files.
+
+1. Follow the instructions for [Configure Zulip to allow HTTP](#configuring-zulip-to-allow-http).
+
+2. Add the following to `/etc/zulip/settings.py`:
+ ```
+ EXTERNAL_HOST = 'zulip.example.com'
+ ALLOWED_HOSTS = ['zulip.example.com', '127.0.0.1']
+ USE_X_FORWARDED_HOST = True
+ ```
+
+
+3. Restart your Zulip server with `/home/zulip/deployments/current/restart-server`.
+
+4. Create an Apache2 virtual host configuration file, similar to the
+ following. Place it the appropriate path for your Apache2
+ installation and enable it (E.g. if you use Debian or Ubuntu, then
+ place it in `/etc/apache2/sites-available/zulip.example.com.conf`
+ and then run `a2ensite zulip.example.com && systemctl reload
+ apache2`):
+
+ ```
+ <VirtualHost *:80>
+ ServerName zulip.example.com
+ RewriteEngine On
+ RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
+ </VirtualHost>
+
+ <VirtualHost *:443>
+ ServerName zulip.example.com
+
+ RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
+ RequestHeader set "X-Forwarded-SSL" expr=%{HTTPS}
+
+ RewriteEngine On
+ RewriteRule /(.*) http://localhost:5080/$1 [P,L]
+
+ <Location />
+ Require all granted
+ ProxyPass http://localhost:5080/ timeout=300
+ ProxyPassReverse http://localhost:5080/
+ ProxyPassReverseCookieDomain 127.0.0.1 zulip.example.com
+ </Location>
+
+ SSLProtocol TLSv1.2
+ SSLEngine on
+ SSLProxyEngine on
+ SSLCertificateFile /etc/letsencrypt/live/zulip.example.com/fullchain.pem
+ SSLCertificateKeyFile /etc/letsencrypt/live/zulip.example.com/privkey.pem
+ SSLCipherSuite "EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA256:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EDH+aRSA+AESGCM:EDH+aRSA+SHA256:EDH+aRSA:EECDH:!aNULL:!eNULL:!MEDIUM:!LOW:!3DES:!MD5:!
+ SSLHonorCipherOrder on
+ Header set Strict-Transport-Security "max-age=31536000"
+ </VirtualHost>
+ ```
+
### HAProxy configuration
If you want to use HAProxy with Zulip, this `backend` config is a good