feat: switch to php-apache docker setup for better compatibility and performance

This commit is contained in:
mstfyldz
2026-05-04 23:42:02 +03:00
parent e4685289f7
commit 1a1fa50daa
5 changed files with 63 additions and 88 deletions

48
.htaccess Normal file
View File

@@ -0,0 +1,48 @@
# GZIP Sıkıştırma
<IfModule mod_deflate.c>
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
</IfModule>
# Tarayıcı Önbellekleme (Caching)
<IfModule mod_expires.c>
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"
</IfModule>
# Cache-Control Başlıklarını Zorla
<IfModule mod_headers.c>
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|webp|js|css|swf|woff2)$">
Header set Cache-Control "max-age=31536000, public"
</FilesMatch>
</IfModule>
# Index.html'i önceliklendir
DirectoryIndex index.html index.php

15
Dockerfile Normal file
View File

@@ -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

View File

@@ -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;
}
}

View File

@@ -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;
}

View File

@@ -1,2 +0,0 @@
# Nixpacks configuration
# Letting Nixpacks decide the best way to build, but keeping it as a reference.