fix: added custom nginx configuration to have gzip compression and cache control

Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
Louis Vallat 2022-06-16 10:54:48 +02:00
parent 127bbc6c38
commit 21169b9e55
No known key found for this signature in database
GPG Key ID: 0C87282F76E61283
2 changed files with 26 additions and 1 deletions

View File

@ -2,5 +2,6 @@ FROM nginx:latest
EXPOSE 80 EXPOSE 80
COPY . /usr/share/nginx/html/ COPY ./src/ /usr/share/nginx/html/
COPY ./nginx.conf /etc/nginx/conf.d/default.conf

24
nginx.conf Normal file
View File

@ -0,0 +1,24 @@
server {
listen 80;
server_name localhost;
gzip on;
gzip_types text/plain application/xml;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
location ~*.(js|css|ico)$ {
root /usr/share/nginx/html;
expires 2d;
add_header Cache-Control "public, no-transform";
}
location ~*.(ttf|png|jpg|jpeg|gif)$ {
root /usr/share/nginx/html;
expires 1y;
add_header Cache-Control "public, no-transform";
}
}