forked from cozy/cozy-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cozy.io.conf
45 lines (36 loc) · 1.19 KB
/
cozy.io.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
server {
listen 80;
server_name _;
root /var/www/;
# By default, look for index.html.
# Also look for files.html (for requests on /mobile/)
index index.html files.html;
# Use Lua for HTTP redirect depending on language
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) == "fr" then
ngx.redirect("/fr/")
end
end
ngx.redirect("/en/")
';
}
# Keep all existing link (before we localized the site) relevant, pointing
# to the english version.
location ~ ^/(hack|host|mobile)(.*) {
rewrite ^/(.*)$ /en/$1 permanent;
}
# /hack/ doesn't have an index, it's actually /hack/getting-started/'s index
location ~ ^/(..)/hack(/)$ {
rewrite ^/(.*)(/)$ /$1/getting-started/ permanent;
}
error_page 404 403 /errors/404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}