Ferhat Gölge
Bilgisayar Amelesi
© 2025 All rights reserved.
VPS Üzerinde Laravel AI Projesi Yayına Alma
(Apache VirtualHost + SSL + GitHub SSH Kurulumu)
Bu rehberde, ai.kitmote.com gibi bir subdomain’i sıfırdan yayına alacağız.
Kuracağımız yapı:
- Apache VirtualHost
- SSL (Let’s Encrypt)
- GitHub SSH deploy
- Laravel klasör yapısı uyumlu çalışma
1️⃣ Apache VirtualHost Kurulumu
📁 Proje dizini
Önce projenin doğru yerde olduğundan emin ol:
cd /var/www
mkdir -p ai.kitmote.com
cd ai.kitmote.com
mkdir -p ai.kitmote.com
cd ai.kitmote.com
Laravel projesi burada olacak.
📄 VirtualHost dosyası oluştur
sudo nano /etc/apache2/sites-available/ai.kitmote.com.conf
İçine şunu yaz:
<VirtualHost *:80>
ServerName ai.kitmote.com
ServerAlias www.ai.kitmote.com
DocumentRoot /var/www/ai.kitmote.com/public
<Directory /var/www/ai.kitmote.com/public>
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/ai_error.log
CustomLog ${APACHE_LOG_DIR}/ai_access.log combined
</VirtualHost>
ServerName ai.kitmote.com
ServerAlias www.ai.kitmote.com
DocumentRoot /var/www/ai.kitmote.com/public
<Directory /var/www/ai.kitmote.com/public>
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/ai_error.log
CustomLog ${APACHE_LOG_DIR}/ai_access.log combined
</VirtualHost>
🔧 Apache modüllerini aç
sudo a2enmod rewrite
🔗 Siteyi aktif et
sudo a2ensite ai.kitmote.com.conf
Varsa default kapat:
sudo a2dissite 000-default.conf
🔄 Apache restart
sudo systemctl restart apache2
✅ Test
Tarayıcıdan:
http://ai.kitmote.com
Laravel varsa açılmalı.
2️⃣ SSL Kurulumu (Let’s Encrypt)
📦 Certbot kur
sudo apt update
sudo apt install certbot python3-certbot-apache -y
sudo apt install certbot python3-certbot-apache -y
🔐 SSL al
sudo certbot --apache -d ai.kitmote.com -d www.ai.kitmote.com
Sorular:
- Email → gir
- Redirect HTTP → YES seç (önemli)
🔁 Auto-renew kontrol
sudo certbot renew --dry-run
✅ Test
https://ai.kitmote.com
3️⃣ GitHub SSH Key Kurulumu
Production deploy için en sağlıklı yöntem: SSH
🔑 SSH key oluştur
ssh-keygen -t ed25519 -C "server@kitmote"
Enter → Enter → Enter
🔍 Public key al
cat ~/.ssh/id_ed25519.pub
Çıkan şeyi kopyala.
🔗 GitHub’a ekle
GitHub →
👉 Settings → SSH and GPG Keys → New SSH Key
🔌 Test
ssh -T git@github.com
Çıktı:
Hi username! You've successfully authenticated
4️⃣ Projeyi Sunucuya Çekme
cd /var/www/ai.kitmote.com
git clone git@github.com:USERNAME/REPO.git .
git clone git@github.com:USERNAME/REPO.git .
⚠️ İzinleri düzelt
sudo chown -R www-data:www-data /var/www/ai.kitmote.com
sudo chmod -R 755 /var/www/ai.kitmote.com
sudo chmod -R 755 /var/www/ai.kitmote.com
Laravel özel:
chmod -R 775 storage bootstrap/cache
5️⃣ Laravel Kurulum Adımları
📦 Bağımlılıklar
composer install --no-dev --optimize-autoloader
⚙️ ENV
cp .env.example .env
nano .env
nano .env
🔑 Key üret
php artisan key:generate
🗄️ Migration
php artisan migrate
⚡ Cache optimize
php artisan config:cache
php artisan route:cache
php artisan view:cache
php artisan route:cache
php artisan view:cache
6️⃣ Production Tavsiyeleri
🔥 Queue (opsiyonel)
php artisan queue:work
Supervisor ile önerilir.
🔍 Log kontrol
tail -f storage/logs/laravel.log
🔄 Deploy sonrası update
git pull origin main
composer install --no-dev
php artisan migrate --force
php artisan optimize
composer install --no-dev
php artisan migrate --force
php artisan optimize
7️⃣ Sık Karşılaşılan Hatalar
❌ 403 Forbidden
→ AllowOverride açık mı?
→ Apache rewrite aktif mi?
❌ 500 Error
→ .env hatası
→ storage izinleri
❌ 502 / boş sayfa
→ Apache çalışıyor mu?
sudo systemctl status apache2
🎯 Sonuç
Bu yapı ile:
- ✅ Domain → VPS bağlandı
- ✅ Apache → Laravel çalışıyor
- ✅ SSL → aktif
- ✅ GitHub → otomatik deploy hazır
Keywords: VPS, SSH Key,