Nginx, yüksek eşzamanlı bağlantı kapasitesiyle Ubuntu Server üzerinde en popüler web sunucusudur. Bu rehberde kurulum, sanal host ve SSL yapılandırmasını anlatıyoruz.
Nginx Kurulumu
sudo apt update
sudo apt install nginx -y
sudo systemctl enable nginx
sudo systemctl status nginx
Virtual Host Oluşturma
sudo nano /etc/nginx/sites-available/ornek.com
sudo ln -s /etc/nginx/sites-available/ornek.com /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
PHP-FPM Entegrasyonu
sudo apt install php-fpm php-mysql -y
Server block içinde fastcgi_pass unix:/var/run/php/php8.3-fpm.sock; tanımlayın.
SSL (Let's Encrypt)
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d ornek.com -d www.ornek.com
Performans İpuçları
gzip on;ile sıkıştırma etkinleştirin.- Statik dosyalar için cache header tanımlayın.
- Worker process sayısını CPU çekirdeğine göre ayarlayın.
İlgili konular: Genel · Sunucular Kategorisi · Ubuntu İşletim Sistemleri