aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilo Casagrande <milo.casagrande@linaro.org>2015-03-23 09:46:07 +0100
committerMilo Casagrande <milo.casagrande@linaro.org>2015-03-23 09:46:07 +0100
commit1c9610d7e80442a7c3585c923a77200faed0030a (patch)
treefe94bc04bbc7693912df369f338ba8df951d9a2f
parentf6de0f79ebad8f1c662c85104cb6ec0628010bae (diff)
ansible: Handle www in URL.2015.3.2
* Handle case of URL typed with www, and redirect to one without it.
-rw-r--r--ansible/roles/configure-nginx/templates/backend-nginx.conf5
1 files changed, 5 insertions, 0 deletions
diff --git a/ansible/roles/configure-nginx/templates/backend-nginx.conf b/ansible/roles/configure-nginx/templates/backend-nginx.conf
index b41d199..c821c08 100644
--- a/ansible/roles/configure-nginx/templates/backend-nginx.conf
+++ b/ansible/roles/configure-nginx/templates/backend-nginx.conf
@@ -1,4 +1,9 @@
server {
+ server_name www.{{ hostname }};
+ return 301 $scheme://{{ hostname }}$request_uri;
+}
+
+server {
server_name {{ hostname }};
root {{ web_root }}/{{ hostname }};
charset utf-8;