diff --git a/Dockerfile b/Dockerfile index 663902b..420ee64 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,6 @@ FROM ubuntu RUN apt-get update RUN apt-get install nginx -y COPY --from=build /app/dist /var/www/html/ -# COPY nginx.conf /etc/nginx/ +COPY nginx.conf /etc/nginx/ EXPOSE 80 CMD ["nginx","-g","daemon off;"] \ No newline at end of file diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..657fef3 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,41 @@ +user www-data; +worker_processes auto; +pid /run/nginx.pid; + +events { + worker_connections 768; +} + +http { + include mime.types; + types { + application/manifest+json webmanifest; + } + + server { + listen 80; + server_name localhost; + root /var/www/html; + index index.html; + + # Cache control for static assets + location ^~ /assets/ { + add_header Cache-Control "public, max-age=31536000, s-maxage=31536000, immutable"; + try_files $uri =404; + } + + # Cache control for workbox scripts + location ^~ /workbox- { + add_header Cache-Control "public, max-age=31536000, s-maxage=31536000, immutable"; + try_files $uri =404; + } + + # Default location with no caching + location / { + autoindex off; + expires off; + add_header Cache-Control "public, max-age=0, s-maxage=0, must-revalidate" always; + try_files $uri /index.html =404; + } + } +} \ No newline at end of file