forked from SORMAS-Foundation/SORMAS-Angular
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
41 lines (32 loc) · 992 Bytes
/
nginx.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
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
server_tokens off;
map $http_accept_language $accept_language {
~*^de de;
~*^fr fr;
~*^en-US en-US;
}
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html/;
# Fallback to default language if no preference defined by browser
if ($accept_language ~ "^$") {
set $accept_language "de";
}
# Redirect "/" to Angular app in browser's preferred language
rewrite ^/$ $scheme://$http_host/$accept_language permanent;
# Everything under the Angular app is always redirected to Angular in the correct language
location ~ ^/(fr|de|en-US) {
try_files $uri /$1/index.html?$args;
}
}
}