diff --git a/Dockerfile b/Dockerfile index ef49599..fa96443 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,9 @@ FROM nginx:stable-alpine -ARG LKRP_UL_URL="https:\/\/lkrp-dev.micord.ru\/ul\/" -ARG LKRP_UL_LANDING="https:\/\/lkrp-dev.micord.ru\/ul\/home.html" -ARG LKRP_FL_URL="https:\/\/lkrp-dev.micord.ru\/fl\/" -ARG LKRP_FL_LANDING="https:\/\/lkrp-dev.micord.ru\/fl\/home.html" - -#COPY nginx.conf /etc/nginx/conf.d/default.conf +COPY config/nginx.conf.template /etc/nginx/templates/ COPY ./html/ /usr/share/nginx/html/ -RUN cd /usr/share/nginx/html \ - && sed -i -r "s/LKRP_UL_URL/$LKRP_UL_URL/g" ./index.html \ - && sed -i -r "s/LKRP_UL_LANDING/$LKRP_UL_LANDING/g" ./index.html \ - && sed -i -r "s/LKRP_FL_URL/$LKRP_FL_URL/g" ./index.html \ - && sed -i -r "s/LKRP_FL_LANDING/$LKRP_FL_LANDING/g" ./index.html +ENV LKRP_UL_URL="https://lkrp-dev.micord.ru/ul/" +ENV LKRP_UL_LANDING="https://lkrp-dev.micord.ru/ul/home.html" +ENV LKRP_FL_URL="https://lkrp-dev.micord.ru/fl" +ENV LKRP_FL_LANDING="https://lkrp-dev.micord.ru/fl/home.html" diff --git a/config/nginx.conf.template b/config/nginx.conf.template new file mode 100644 index 0000000..fdcae5d --- /dev/null +++ b/config/nginx.conf.template @@ -0,0 +1,72 @@ +log_format nginx_main + '$remote_addr - $remote_user [$time_local] $request ' + '"$status" $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for" ' + '"$request_filename" "$gzip_ratio" $upstream_response_time server: $host : $document_root $fastcgi_script_name '; + +server { + listen 80 default; + + access_log /var/log/nginx/access.log nginx_main; + error_log /var/log/nginx/error.log error; + + sendfile off; + charset utf-8; + + client_max_body_size 32m; + + ## + # `gzip` Settings + # + # + gzip on; + gzip_disable "msie6"; + + gzip_vary on; + gzip_proxied any; + gzip_comp_level 6; + gzip_buffers 16 8k; + gzip_http_version 1.1; + gzip_min_length 256; + gzip_types + application/atom+xml + application/geo+json + application/javascript + application/x-javascript + application/json + application/ld+json + application/manifest+json + application/rdf+xml + application/rss+xml + application/xhtml+xml + application/xml + font/eot + font/otf + font/ttf + image/svg+xml + text/css + text/javascript + text/plain + text/xml; + + root /usr/share/nginx/html; + + location / { + index index.html; + expires -1; + + ssi on; + set $flUrl "${LKRP_FL_URL}"; + set $flLandingUrl "${LKRP_FL_LANDING}"; + set $ulUrl "${LKRP_UL_URL}"; + set $ulLandingUrl "${LKRP_UL_LANDING}"; + + try_files $uri $uri/ $uri/index.html; + } + + location = /health { + access_log off; + add_header 'Content-Type' 'application/json'; + return 200 '{"status":"UP"}'; + } +} diff --git a/html/index.html b/html/index.html index 6447155..9b929c0 100644 --- a/html/index.html +++ b/html/index.html @@ -28,14 +28,14 @@