fix: force caching headers for CSS and JS files with version strings

This commit is contained in:
mstfyldz
2026-05-05 00:07:18 +03:00
parent d1bf2829cf
commit 5808186afc

View File

@@ -3,7 +3,7 @@ FROM php:8.2-apache
# Modülleri aktif et
RUN a2enmod rewrite expires deflate headers
# Apache Site Konfigürasyonunu doğrudan güncelle (Header ve Önbellek zorlaması)
# Apache Site Konfigürasyonunu doğrudan güncelle (CSS ve JS zorlaması ile)
RUN echo '<VirtualHost *:80>\n\
DocumentRoot /var/www/html\n\
<Directory /var/www/html>\n\
@@ -19,11 +19,13 @@ RUN echo '<VirtualHost *:80>\n\
ExpiresByType image/png "access plus 1 year"\n\
ExpiresByType image/webp "access plus 1 year"\n\
ExpiresByType font/woff2 "access plus 1 year"\n\
ExpiresByType text/css "access plus 1 month"\n\
ExpiresByType application/javascript "access plus 1 month"\n\
ExpiresByType text/css "access plus 1 year"\n\
ExpiresByType application/javascript "access plus 1 year"\n\
</IfModule>\n\
<IfModule mod_headers.c>\n\
Header set Cache-Control "max-age=31536000, public"\n\
<FilesMatch "\\.(css|js|jpg|jpeg|png|gif|webp|woff2|svg)$">\n\
Header set Cache-Control "max-age=31536000, public, immutable"\n\
</FilesMatch>\n\
</IfModule>\n\
</VirtualHost>' > /etc/apache2/sites-available/000-default.conf