Skip to content

Commit

Permalink
Добавил сжатие gzip и brotli в nginx
Browse files Browse the repository at this point in the history
  • Loading branch information
SergTyapkin committed Apr 27, 2024
1 parent 02b7801 commit 88c14f2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![GithubCI](https://github.com/sergtyapkin/vue-frontend-template/actions/workflows/deploy.yml/badge.svg)

# Фронтенд на Vue.js с авто-деплоем на _Nginx_ в докере и автоматическим получением сертификатов _Letsencript_
# Фронтенд на Vue.js с авто-деплоем на _Nginx_ в докере и автоматическим получением сертификатов _Letsencrypt_
В общем все, чтобы раскатить фронтенд за 10 минут на чистой машине с Ubuntu

## Развертка для разработки
Expand Down
5 changes: 5 additions & 0 deletions docker-deploy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ RUN export DOMAIN_URL=${DOMAIN_URL} && \

# Finally - get only needed files from previous build stage. Static files + config
FROM nginx:${NGINX_RELEASE:-1.23}

#install nginx modules
RUN apt-get update -y && apt-get install --no-install-recommends -y \
nginx-plus-module-brotli

COPY --from=build /home/node/front/dist /frontend-dist
COPY --from=build /home/node/front/docker-deploy/nginx/nginx.conf /etc/nginx/nginx-not-substituted.conf
COPY --from=build /home/node/front/docker-deploy/nginx/_nginx-substituted.conf /etc/nginx/nginx.conf
6 changes: 6 additions & 0 deletions docker-deploy/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
load_module modules/ngx_http_brotli_filter_module.so; # for compressing responses on-the-fly
load_module modules/ngx_http_brotli_static_module.so; # for serving pre-compressed files

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
Expand All @@ -23,6 +26,9 @@ http {
keepalive_timeout 65;
types_hash_max_size 2048;

gzip on;
brotli on;

include /etc/nginx/mime.types;
default_type application/octet-stream;

Expand Down

0 comments on commit 88c14f2

Please sign in to comment.