From 0b2a4e3d4b0a1a887a0b4a779b397185ed52084f Mon Sep 17 00:00:00 2001 From: Dave Date: Thu, 11 Feb 2016 19:03:51 +0100 Subject: [PATCH] nginx configuration --- Install-Wekan-Docker-in-production.md | 57 ++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/Install-Wekan-Docker-in-production.md b/Install-Wekan-Docker-in-production.md index fb125f8..b2bf1b8 100644 --- a/Install-Wekan-Docker-in-production.md +++ b/Install-Wekan-Docker-in-production.md @@ -38,7 +38,8 @@ wekandb: ... ``` -## 3. Configure Apache as a front-end proxy +## 3. Configure webserver as a front-end proxy +### 3.a Apache * Enable Mod_Proxy: `sudo a2enmod proxy proxy_http proxy_wstunnel` then restart Apache `service apache2 restart` * Configure your virtual host (vhost) @@ -87,6 +88,60 @@ Reload Apache `sudo service apache2 reload` [Apache Mod_Proxy documentation](http://httpd.apache.org/docs/current/mod/mod_proxy.html) +### 3.b nginx + +Existing configuration: + +```nginxConf +server { + listen 123.45.67.89:80; + server_name mytodo.org; + + access_log /var/log/nginx/mytodo_access.log; + error_log /var/log/nginx/mytodo_error.log; + + [...] +} +``` + +Add the following after the `error_log` line: + +```nginxConf +location / { + proxy_read_timeout 300; + proxy_connect_timeout 300; + proxy_redirect off; + + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + proxy_pass http://127.0.0.1:8081; + } + +location ~ websocket$ { + proxy_pass http://websocket; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; +} +``` + +And the following above your `server` line + +```nginxConf +upstream websocket { + server 127.0.0.1:8081; +} + +map $http_upgrade $connection_upgrade { + default upgrade; + '' close; +} +``` + + ## 4. Launch Wekan As `wekan` user and from `/home/wekan`, run `docker-compose up -d`