updated server configuration

document root is at /usr/share/nginx/html
map app is located in /usr/share/nginx/html
server responds to /, /map, /map/, /karte, /karte/
server uses DE or EN page depending on $http_accept_language as set by client
This commit is contained in:
Kasper D. Fischer 2021-10-30 22:38:57 +02:00
parent af7c6642ff
commit bbee8038a2
2 changed files with 23 additions and 8 deletions

View File

@ -10,4 +10,4 @@ COPY nginx/mime.types /etc/nginx/mime.types
COPY nginx/default.conf /etc/nginx/conf.d/default.conf COPY nginx/default.conf /etc/nginx/conf.d/default.conf
# copy webpage content # copy webpage content
COPY www /usr/share/nginx/html COPY www /usr/share/nginx/html/map

View File

@ -16,16 +16,31 @@ server {
set $language_suffix 'de'; set $language_suffix 'de';
} }
location / { #rewrite rules to /map/
root /usr/share/nginx/html; rewrite ^(.*)/index(\.html)*$ /map/index.html.$language_suffix last;
index index.html.$language_suffix index.htm.$language_suffix index.html index.htm rewrite ^/favicon.ico$ /map/favicon.ico last;
try_files $uri.$language_suffix $uri $uri.html.$language_suffix $uri.html $uri.htm.$language_suffix $uri.htm; rewrite ^/map$ /map/ last;
rewrite ^/map.js$ /map/map.js last;
rewrite ^/karte$ /map/ last;
rewrite ^/karte/$ /map/ last;
rewrite ^/karte/(.*)$ /map/$1 last;
if ($uri !~ "^/map") {
rewrite ^(.*)/(.*)$ /map$1/$2 last;
} }
#location / {
# root /usr/share/nginx/html; #location /map {
# index index.html index.htm; # root /usr/share/nginx/html/;
# index index.html.$language_suffix index.html;
# #try_files $uri.$language_suffix $uri.html.$language_suffix $uri.html $uri index.html.$language_suffix index.html;
#} #}
location / {
root /usr/share/nginx/html/;
index index.html.$language_suffix index.html;
}
#error_page 404 /404.html; #error_page 404 /404.html;
# redirect server error pages to the static page /50x.html # redirect server error pages to the static page /50x.html