taler-deployment

Deployment scripts and configuration files
Log | Files | Refs | README

commit 6f2749e4c45f7d985d2998500215bc78ec9c5523
parent 8348785ed1c1febc6a7966cdab49191abe666961
Author: tg(x) <*@tg-x.net>
Date:   Fri, 20 Jan 2017 00:07:15 +0100

nginx: taler.net: redirect based on accept-language header

Diffstat:
Metc/nginx/nginx.conf | 2++
Metc/nginx/sites-enabled/www-ssl.site | 23+++++++++++++++++++++++
2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/etc/nginx/nginx.conf b/etc/nginx/nginx.conf @@ -2,6 +2,8 @@ user www-data; worker_processes 4; pid /var/run/nginx.pid; +include /etc/nginx/modules-enabled/*.conf; + events { worker_connections 768; # multi_accept on; diff --git a/etc/nginx/sites-enabled/www-ssl.site b/etc/nginx/sites-enabled/www-ssl.site @@ -9,6 +9,29 @@ server { server_name www.taler.net; include conf.d/talerssl; + location = / { + rewrite_by_lua ' + for lang in (ngx.var.http_accept_language .. ","):gmatch("([^,]*),") do + if string.sub(lang, 0, 2) == "en" then + ngx.redirect("/en/") + end + if string.sub(lang, 0, 2) == "de" then + ngx.redirect("/de/") + end + if string.sub(lang, 0, 2) == "fr" then + ngx.redirect("/fr/") + end + if string.sub(lang, 0, 2) == "it" then + ngx.redirect("/it/") + end + if string.sub(lang, 0, 2) == "es" then + ngx.redirect("/es/") + end + end + ngx.redirect("/en/") + '; + } + location / { root /var/www/taler.net; autoindex off;