DEVOPS-1892: added cache settings
moved from angie to nginx
This commit is contained in:
parent
2410574b64
commit
1b98944498
3 changed files with 82 additions and 140 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
ARG BUILDER_IMAGE=registry.altlinux.org/basealt/altsp:c10f1
|
ARG BUILDER_IMAGE=registry.altlinux.org/basealt/altsp:c10f1
|
||||||
ARG BACKEND_IMAGE=repo.micord.ru/alt/alt-tomcat:c10f1-9.0.59-20240903
|
ARG BACKEND_IMAGE=repo.micord.ru/alt/alt-tomcat:c10f1-9.0.59-20240903
|
||||||
ARG FRONTEND_IMAGE=docker.angie.software/angie:latest
|
ARG FRONTEND_IMAGE=nginx:1.24-alpine-slim
|
||||||
|
|
||||||
FROM $BUILDER_IMAGE AS builder
|
FROM $BUILDER_IMAGE AS builder
|
||||||
|
|
||||||
|
|
@ -45,5 +45,5 @@ COPY --from=builder /app/frontend/target/frontend*.war /var/lib/tomcat/webapps/R
|
||||||
|
|
||||||
FROM $FRONTEND_IMAGE AS frontend
|
FROM $FRONTEND_IMAGE AS frontend
|
||||||
|
|
||||||
COPY config/angie.conf /etc/angie/angie.conf
|
COPY config/nginx.conf /etc/nginx/nginx.conf
|
||||||
COPY --from=builder /app/frontend/dist /frontend
|
COPY --from=builder /app/frontend/dist /frontend
|
||||||
|
|
|
||||||
|
|
@ -1,84 +0,0 @@
|
||||||
include /etc/angie/modules-enabled.d/*.conf;
|
|
||||||
|
|
||||||
worker_processes 10;
|
|
||||||
|
|
||||||
error_log /var/log/angie/error.log;
|
|
||||||
|
|
||||||
events {
|
|
||||||
worker_connections 1024;
|
|
||||||
}
|
|
||||||
|
|
||||||
include /etc/angie/conf-enabled.d/*.conf;
|
|
||||||
|
|
||||||
http {
|
|
||||||
include /etc/angie/mime.types;
|
|
||||||
default_type application/octet-stream;
|
|
||||||
|
|
||||||
sendfile on;
|
|
||||||
|
|
||||||
gzip on;
|
|
||||||
|
|
||||||
# text/html doesn't need to be defined there, it's compressed always
|
|
||||||
gzip_types text/plain text/css text/xml application/x-javascript application/atom+xml;
|
|
||||||
|
|
||||||
# gzip_comp_level 9;
|
|
||||||
include /etc/angie/sites-enabled.d/*.conf;
|
|
||||||
|
|
||||||
log_format angie_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/angie/access.log angie_main;
|
|
||||||
error_log /var/log/angie/error.log error;
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
root /frontend;
|
|
||||||
index index.html;
|
|
||||||
expires -1;
|
|
||||||
try_files $uri $uri/ $uri/index.html;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -11,74 +11,100 @@ events {
|
||||||
include /etc/nginx/conf-enabled.d/*.conf;
|
include /etc/nginx/conf-enabled.d/*.conf;
|
||||||
|
|
||||||
http {
|
http {
|
||||||
include /etc/nginx/mime.types;
|
include /etc/nginx/mime.types;
|
||||||
default_type application/octet-stream;
|
default_type application/octet-stream;
|
||||||
|
|
||||||
sendfile on;
|
sendfile on;
|
||||||
|
|
||||||
gzip on;
|
gzip on;
|
||||||
|
|
||||||
# text/html doesn't need to be defined there, it's compressed always
|
# text/html doesn't need to be defined there, it's compressed always
|
||||||
gzip_types text/plain text/css text/xml application/x-javascript application/atom+xml;
|
gzip_types text/plain text/css text/xml application/x-javascript application/atom+xml;
|
||||||
|
|
||||||
# gzip_comp_level 9;
|
# gzip_comp_level 9;
|
||||||
include /etc/nginx/sites-enabled.d/*.conf;
|
include /etc/nginx/sites-enabled.d/*.conf;
|
||||||
|
|
||||||
log_format nginx_main
|
log_format nginx_main
|
||||||
'$remote_addr - $remote_user [$time_local] $request '
|
'$remote_addr - $remote_user [$time_local] $request '
|
||||||
'"$status" $body_bytes_sent "$http_referer" '
|
'"$status" $body_bytes_sent "$http_referer" '
|
||||||
'"$http_user_agent" "$http_x_forwarded_for" '
|
'"$http_user_agent" "$http_x_forwarded_for" '
|
||||||
'"$request_filename" "$gzip_ratio" $upstream_response_time server: $host : $document_root $fastcgi_script_name ';
|
'"$request_filename" "$gzip_ratio" $upstream_response_time server: $host : $document_root $fastcgi_script_name ';
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80 default;
|
listen 80 default;
|
||||||
|
|
||||||
access_log /var/log/nginx/access.log nginx_main;
|
access_log /var/log/nginx/access.log nginx_main;
|
||||||
error_log /var/log/nginx/error.log error;
|
error_log /var/log/nginx/error.log error;
|
||||||
|
|
||||||
charset utf-8;
|
charset utf-8;
|
||||||
|
|
||||||
client_max_body_size 32m;
|
client_max_body_size 32m;
|
||||||
|
|
||||||
##
|
##
|
||||||
# `gzip` Settings
|
# `gzip` Settings
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
gzip on;
|
gzip on;
|
||||||
gzip_disable "msie6";
|
gzip_disable "msie6";
|
||||||
|
|
||||||
gzip_vary on;
|
gzip_vary on;
|
||||||
gzip_proxied any;
|
gzip_proxied any;
|
||||||
gzip_comp_level 6;
|
gzip_comp_level 6;
|
||||||
gzip_buffers 16 8k;
|
gzip_buffers 16 8k;
|
||||||
gzip_http_version 1.1;
|
gzip_http_version 1.1;
|
||||||
gzip_min_length 256;
|
gzip_min_length 256;
|
||||||
gzip_types
|
gzip_types
|
||||||
application/atom+xml
|
application/atom+xml
|
||||||
application/geo+json
|
application/geo+json
|
||||||
application/javascript
|
application/javascript
|
||||||
application/x-javascript
|
application/x-javascript
|
||||||
application/json
|
application/json
|
||||||
application/ld+json
|
application/ld+json
|
||||||
application/manifest+json
|
application/manifest+json
|
||||||
application/rdf+xml
|
application/rdf+xml
|
||||||
application/rss+xml
|
application/rss+xml
|
||||||
application/xhtml+xml
|
application/xhtml+xml
|
||||||
application/xml
|
application/xml
|
||||||
font/eot
|
font/eot
|
||||||
font/otf
|
font/otf
|
||||||
font/ttf
|
font/ttf
|
||||||
image/svg+xml
|
image/svg+xml
|
||||||
text/css
|
text/css
|
||||||
text/javascript
|
text/javascript
|
||||||
text/plain
|
text/plain
|
||||||
text/xml;
|
text/xml;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
root /frontend;
|
root /frontend;
|
||||||
index index.html;
|
index index.html;
|
||||||
expires -1;
|
try_files $uri @index;
|
||||||
try_files $uri $uri/ $uri/index.html;
|
|
||||||
}
|
# Media: images, icons, video, audio, HTC
|
||||||
}
|
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|mp3|ogg|ogv|webm|htc|woff2|woff|ttf)$ {
|
||||||
|
expires 1M;
|
||||||
|
access_log off;
|
||||||
|
# max-age must be in seconds
|
||||||
|
add_header Cache-Control "max-age=2629746, public";
|
||||||
|
}
|
||||||
|
# CSS and Javascript
|
||||||
|
location ~* \.(?:css|js)$ {
|
||||||
|
expires 1y;
|
||||||
|
access_log off;
|
||||||
|
add_header Cache-Control "max-age=31556952, public";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
location @index {
|
||||||
|
root /frontend;
|
||||||
|
add_header Cache-Control no-cache;
|
||||||
|
expires 0;
|
||||||
|
try_files /index.html =404;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /health {
|
||||||
|
access_log off;
|
||||||
|
add_header 'Content-Type' 'application/json';
|
||||||
|
return 200 '{"status":"UP"}';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue