Oxygen Chrome Ubuntu üzerinde Apache + Nginx GZIP + Cache Optimizasyonu Rehberi - SONMEZZ

Konuyu Sesli Okuma

Manşet

En Yeniler
⏳ Manşetler yükleniyor...

Duyuru Alanı

Kutsal Bilgi
Kutsal Bilgi Tapınağı
Hoş Geldiniz Bilge Yolcu

Story

Yönetici
Admin
SVIP Member
Verified
Puanlar
5186
Başarılar
8

🚀 Ubuntu Apache & Nginx GZIP + Cache Optimizasyon Rehberi

Ubuntu üzerinde GZIP sıkıştırması ve tarayıcı önbellekleme ayarları ile sunucu performansını artırın ve sayfa yükleme hızını yükseltin.

1️⃣ GZIP (Dosya Sıkıştırma)

GZIP, sunucudan tarayıcıya gönderilen dosyaları sıkıştırarak daha hızlı sayfa yüklenmesini sağlar.


🅐 Apache Üzerinde GZIP – Ubuntu

Modülleri Etkinleştirin:

sudo a2enmod deflate
sudo a2enmod headers
sudo systemctl restart apache2

GZIP Yapılandırma Dosyası Oluşturun:

sudo nano /etc/apache2/conf-available/gzip.conf

İçeriği ekleyin:

<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE text/javascript
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE image/svg+xml
    AddOutputFilterByType DEFLATE image/x-icon
    AddOutputFilterByType DEFLATE font/ttf
    AddOutputFilterByType DEFLATE font/otf
    AddOutputFilterByType DEFLATE font/woff

    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    Header append Vary User-Agent
</IfModule>

Yapılandırmayı etkinleştirin:

sudo a2enconf gzip
sudo systemctl restart apache2

🅑 Nginx Üzerinde GZIP – Ubuntu

GZIP yapılandırması ekleyin:

sudo nano /etc/nginx/conf.d/gzip.conf

İçerik:

gzip on;
gzip_disable "msie6";
gzip_comp_level 5;
gzip_proxied any;
gzip_vary on;
gzip_types
    text/plain
    text/css
    text/xml
    text/javascript
    application/javascript
    application/x-javascript
    application/xml
    application/rss+xml
    image/svg+xml
    image/bmp
    image/x-icon;

Nginx yeniden başlatın:

sudo systemctl restart nginx

2️⃣ Tarayıcı Önbellekleme (Cache)

Cache ayarları sayesinde statik dosyalar tarayıcıda saklanır ve tekrar ziyaretlerde çok daha hızlı açılır.


🅐 Apache Cache – Ubuntu

Modülü etkinleştirin:

sudo a2enmod expires
sudo systemctl restart apache2

Cache yapılandırma dosyası oluşturun:

sudo nano /etc/apache2/conf-available/cache.conf

İçerik:

ExpiresActive On
ExpiresDefault "access plus 14 days"

ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 month"
ExpiresByType text/html "access plus 1 day"

Yapılandırmayı aktif edin:

sudo a2enconf cache
sudo systemctl restart apache2

🅑 Nginx Cache – Ubuntu

Site yapılandırmasına ekleyin:

sudo nano /etc/nginx/sites-available/default

server bloğuna ekle:

location ~* \.(jpg|jpeg|png|gif|svg|ico|css|js|woff|woff2|pdf)$ {
    expires 30d;
    add_header Cache-Control "public, no-transform";
}

Nginx yeniden başlatın:

sudo systemctl restart nginx

3️⃣ Servisleri Yeniden Başlatma

# Apache
sudo systemctl restart apache2

# Nginx
sudo systemctl restart nginx

✅ GZIP ve Cache optimizasyonu Ubuntu’da başarıyla tamamlandı!

Doğrulama araçları:
GZIP TestCache Test

Yanıtlamak için burayı tıklayın.
comment url
Giriş Yap