Linux VPS

Apache HTTP Server kurulumu

HolyCloud VPS üzerinde Apache'yi kurun ve yapılandırın: sanal konaklar, modüller, MPM, günlükler ve PHP-FPM veya ters vekil entegrasyonu.

~10 dk. okuma Orta seviye #apache#httpd#virtualhost#web

Apache HTTP Server, HolyCloud Linux VPS örneklerinde en yaygın kullanılan web sunucularından biridir. Bu kılavuz apt üzerinden kurulumu, Debian/Ubuntu'daki site yapısını, sık kullanılan modüllerin etkinleştirilmesini, adlandırılmış bir sanal konağı ve yapılandırma denetimlerini kapsar.

Ön koşullar

  • Ubuntu 22.04/24.04 veya Debian 12 HolyCloud VPS
  • sudo erişimi
  • Alan adı (yalnızca IP ile test için isteğe bağlı)
  • 80/443 portları açık (UFW + HolyCloud güvenlik duvarı)
  • En az 512 MB RAM (PHP-FPM ile 1–2 GB önerilir)

İpucu: systemctl reload apache2 öncesinde her zaman apache2ctl configtest çalıştırın.

Adım 1: Kurulum

sudo apt update
sudo apt install -y apache2
sudo systemctl enable --now apache2
sudo systemctl status apache2

Sürüm:

apache2 -v

Yerel test:

curl -I http://127.0.0.1

Adım 2: Debian/Ubuntu yapısı

-------- ------
/etc/apache2/apache2.conf Genel yapılandırma
/etc/apache2/sites-available/ Kullanılabilir sanal konaklar
/etc/apache2/sites-enabled/ Etkin sitelere sembolik bağlantılar
/etc/apache2/mods-available/ Modüller
/var/www/html/ Varsayılan DocumentRoot
/var/log/apache2/ Günlükler

Siteleri ve modülleri listeleyin:

apache2ctl -S
apache2ctl -M
ls -la /etc/apache2/sites-enabled/

Adım 3: Yararlı modüller

sudo a2enmod rewrite ssl headers proxy proxy_http proxy_fcgi setenvif
sudo a2enconf charset
sudo systemctl reload apache2

Adlandırılmış bir vhost kullanıyorsanız varsayılan sayfayı devre dışı bırakın:

sudo a2dissite 000-default.conf

Adım 4: HTTP sanal konağı

sudo mkdir -p /var/www/exemple.fr/public_html
echo '<h1>Apache HolyCloud</h1>' | sudo tee /var/www/exemple.fr/public_html/index.html
sudo chown -R www-data:www-data /var/www/exemple.fr

Site dosyası:

sudo nano /etc/apache2/sites-available/exemple.fr.conf
<VirtualHost *:80>
    ServerName exemple.fr
    ServerAdmin [email protected]
    DocumentRoot /var/www/exemple.fr/public_html

    <Directory /var/www/exemple.fr/public_html>
        Options -Indexes +FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/exemple.fr-error.log
    CustomLog ${APACHE_LOG_DIR}/exemple.fr-access.log combined
</VirtualHost>

Etkinleştirin:

sudo a2ensite exemple.fr.conf
sudo apache2ctl configtest
sudo systemctl reload apache2

Adım 5: MPM ve PHP-FPM

Etkin MPM'i görüntüleyin:

apache2ctl -V | grep MPM

PHP için mpm_event ile php-fpm tercih edin:

sudo apt install -y php-fpm
sudo a2dismod mpm_prefork 2>/dev/null || true
sudo a2enmod mpm_event proxy_fcgi
sudo a2enconf php8.2-fpm 2>/dev/null || sudo a2enconf php8.3-fpm

VirtualHost içinde:

    <FilesMatch \.php$>
        SetHandler "proxy:unix:/run/php/php8.2-fpm.sock|fcgi://localhost"
    </FilesMatch>
sudo systemctl reload apache2

Adım 6: Güvenlik duvarı ve temel sınırlar

sudo ufw allow 'Apache Full'
sudo ufw status

Hafif ayar dosyası (küçük VPS):

sudo nano /etc/apache2/mods-available/mpm_event.conf

MaxRequestWorkers değerini RAM'e göre ayarlayın; değişikliklerden sonra yeniden yükleyin.

Adım 7: Günlükler ve döndürme

sudo tail -f /var/log/apache2/exemple.fr-access.log
sudo tail -f /var/log/apache2/exemple.fr-error.log

Başarısız istekler:

sudo grep -i error /var/log/apache2/exemple.fr-error.log | tail -20

Doğrulama

sudo apache2ctl configtest
curl -H 'Host: exemple.fr' http://127.0.0.1/
sudo ss -tlnp | grep -E ':80|:443'
systemctl is-active apache2

Tarayıcı: http://exemple.fr sayfanızı gösterir; apache2ctl -S, vhost'u 80 numaralı portta listeler.

HolyCloud desteği

  • AH00558 sunucu adı: genel yapılandırmaya veya vhost içine ServerName ekleyin
  • 80 numaralı port kullanımda: sudo ss -tlnp | grep :80
  • Yönlendirme döngüsü: .htaccess veya vekil kuralları — curl -v ile test edin
  • HolyCloud destek ekibi: apache2ctl -S, error.log kesitleri, free -h