From 1a1fa50daade94966786b9888a6b8004fd2c3b88 Mon Sep 17 00:00:00 2001 From: mstfyldz Date: Mon, 4 May 2026 23:42:02 +0300 Subject: [PATCH] feat: switch to php-apache docker setup for better compatibility and performance --- .htaccess | 48 +++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 15 ++++++++++++++ nginx.conf | 43 ---------------------------------------- nginx.template.conf | 43 ---------------------------------------- nixpacks.toml | 2 -- 5 files changed, 63 insertions(+), 88 deletions(-) create mode 100644 .htaccess create mode 100644 Dockerfile delete mode 100644 nginx.conf delete mode 100644 nginx.template.conf delete mode 100644 nixpacks.toml diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..5ef6284 --- /dev/null +++ b/.htaccess @@ -0,0 +1,48 @@ +# GZIP Sıkıştırma + + AddOutputFilterByType DEFLATE text/plain + AddOutputFilterByType DEFLATE text/html + AddOutputFilterByType DEFLATE text/xml + AddOutputFilterByType DEFLATE text/css + AddOutputFilterByType DEFLATE application/xml + AddOutputFilterByType DEFLATE application/xhtml+xml + AddOutputFilterByType DEFLATE application/rss+xml + AddOutputFilterByType DEFLATE application/javascript + AddOutputFilterByType DEFLATE application/x-javascript + AddOutputFilterByType DEFLATE font/woff2 + + +# Tarayıcı Önbellekleme (Caching) + + ExpiresActive On + ExpiresDefault "access plus 1 month" + + # Görseller ve Fontlar (1 Yıl) + ExpiresByType image/jpg "access plus 1 year" + ExpiresByType image/jpeg "access plus 1 year" + ExpiresByType image/png "access plus 1 year" + ExpiresByType image/gif "access plus 1 year" + ExpiresByType image/webp "access plus 1 year" + ExpiresByType image/svg+xml "access plus 1 year" + ExpiresByType image/x-icon "access plus 1 year" + ExpiresByType font/woff2 "access plus 1 year" + ExpiresByType font/woff "access plus 1 year" + ExpiresByType application/font-woff2 "access plus 1 year" + + # CSS ve JS (1 Ay) + ExpiresByType text/css "access plus 1 month" + ExpiresByType application/javascript "access plus 1 month" + + # HTML (1 Saat) + ExpiresByType text/html "access plus 1 hour" + + +# Cache-Control Başlıklarını Zorla + + + Header set Cache-Control "max-age=31536000, public" + + + +# Index.html'i önceliklendir +DirectoryIndex index.html index.php diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7107ce9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM php:8.2-apache + +# Apache modüllerini aktif et (Rewrite, Expires, Sıkıştırma için) +RUN a2enmod rewrite expires deflate headers + +# Proje dosyalarını kopyala +COPY . /var/www/html/ + +# İzinleri ayarla +RUN chown -R www-data:www-data /var/www/html/ + +# Çalışma dizini +WORKDIR /var/www/html + +EXPOSE 80 diff --git a/nginx.conf b/nginx.conf deleted file mode 100644 index cb17c0e..0000000 --- a/nginx.conf +++ /dev/null @@ -1,43 +0,0 @@ -server { - listen 80; - server_name _; - root /usr/share/nginx/html; - index index.html; - - # GZIP Compression - gzip on; - gzip_vary on; - gzip_proxied any; - gzip_comp_level 6; - gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml font/woff2; - - # Browser Caching - location ~* \.(jpg|jpeg|png|gif|webp|svg|ico|cur|gz|svgz|mp4|ogg|ogv|webm|htc)$ { - expires 1y; - access_log off; - add_header Cache-Control "public, max-age=31536000, immutable"; - } - - location ~* \.(css|js)$ { - expires 1M; - access_log off; - add_header Cache-Control "public, max-age=2592000, immutable"; - } - - location ~* \.(woff|woff2|ttf|otf|eot)$ { - expires 1y; - access_log off; - add_header Cache-Control "public, max-age=31536000, immutable"; - } - - # HTML - No cache - location ~* \.(html|htm)$ { - expires 1h; - add_header Cache-Control "public, max-age=3600, must-revalidate"; - } - - error_page 404 /404.html; - location = /404.html { - internal; - } -} diff --git a/nginx.template.conf b/nginx.template.conf deleted file mode 100644 index 4bb7269..0000000 --- a/nginx.template.conf +++ /dev/null @@ -1,43 +0,0 @@ -server { - listen 80; - server_name _; - root /usr/share/nginx/html; - index index.html index.php; - - # GZIP Compression - gzip on; - gzip_vary on; - gzip_proxied any; - gzip_comp_level 6; - gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml font/woff2; - - # Browser Caching - location ~* \.(jpg|jpeg|png|gif|webp|svg|ico|cur|gz|svgz|mp4|ogg|ogv|webm|htc)$ { - expires 1y; - add_header Cache-Control "public, max-age=31536000, immutable"; - } - - location ~* \.(css|js)$ { - expires 1M; - add_header Cache-Control "public, max-age=2592000, immutable"; - } - - location ~* \.(woff|woff2|ttf|otf|eot)$ { - expires 1y; - add_header Cache-Control "public, max-age=31536000, immutable"; - } - - location / { - try_files $uri $uri/ /index.html /index.php?$query_string; - } - - # PHP Handling (Nixpacks default fastcgi path) - location ~ \.php$ { - fastcgi_pass 127.0.0.1:9000; - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - include fastcgi_params; - } - - error_page 404 /404.html; -} diff --git a/nixpacks.toml b/nixpacks.toml deleted file mode 100644 index 021c9ff..0000000 --- a/nixpacks.toml +++ /dev/null @@ -1,2 +0,0 @@ -# Nixpacks configuration -# Letting Nixpacks decide the best way to build, but keeping it as a reference.