Skip to content
Snippets Groups Projects
Commit 937ae649 authored by enricostano's avatar enricostano
Browse files

Use Lua script to manage multi-language redirects

parent f2c35ec6
No related branches found
No related tags found
No related merge requests found
[submodule "vendor/nginx-http-accept-lang"]
path = vendor/nginx-http-accept-lang
url = git@github.com:fghibellini/nginx-http-accept-lang
......@@ -4,3 +4,6 @@
- name: Create Git bare repositories directory
file: path=/home/ubuntu/repos state=directory group=coopdevs owner=ubuntu mode=2775
- name: Create shared directory
file: path=/home/ubuntu/shared state=directory group=coopdevs owner=ubuntu mode=2775
......@@ -4,8 +4,18 @@ server {
server_name coopdevs.org www.coopdevs.org;
root /opt/sites/coopdevs;
index index.html;
# Initial i18n redirect
location = / {
default_type text/html;
expires 1d;
set $ngx_html_path $document_root;
content_by_lua_file /home/ubuntu/shared/nginx/lang.lua;
}
location / {
root /opt/sites/coopdevs;
index index.html;
expires 1d;
}
}
......@@ -7,7 +7,7 @@
- name: Install nginx package
apt:
name: 'nginx'
name: 'nginx-extras'
state: present
- name: Add `www-data` user to `coopdevs` group
......
......@@ -6,6 +6,18 @@
src: roles/http-server/files/nginx.conf
dest: /etc/nginx/nginx.conf
- name: Create shared nginx directory
file:
path: /home/ubuntu/shared/nginx
state: directory
- name: Copy the lua lang module
notify: Reload NGINX
copy:
src: vendor/nginx-http-accept-lang/lang.lua
dest: /home/ubuntu/shared/nginx/lang.lua
mode: 'u+x'
- name: Remove default nginx site
file:
path: /etc/nginx/sites-enabled/default
......
Subproject commit 52040947dee481fbfdb52550cd15e56489462474
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment