86 lines
2.3 KiB
Markdown
86 lines
2.3 KiB
Markdown
# Panduan Deploy ke Hosting FTP
|
|
|
|
## 1) Siapkan file yang wajib di-upload
|
|
Upload seluruh isi project, kecuali folder yang biasanya tidak perlu di-upload (atau bisa di-skip jika hosting sudah menyediakannya):
|
|
- `app/`
|
|
- `bootstrap/`
|
|
- `config/`
|
|
- `database/`
|
|
- `public/`
|
|
- `resources/`
|
|
- `routes/`
|
|
- `storage/` (upload isi folder, termasuk `app`, `framework`, `logs`)
|
|
- `vendor/`
|
|
- `.env`
|
|
- `artisan`
|
|
- `composer.json`
|
|
- `composer.lock`
|
|
- `package.json`
|
|
- `vite.config.js`
|
|
|
|
> Untuk shared hosting, biasanya yang penting adalah semua file aplikasi kecuali `node_modules` dan folder cache yang bisa dibuat ulang.
|
|
|
|
## 2) Atur folder root hosting
|
|
Jika hosting Anda memakai folder publik seperti `public_html`, maka:
|
|
- upload semua project ke folder utama project, misalnya `public_html` atau subfolder.
|
|
- pastikan file `index.php` dari folder `public/` dipindahkan ke root web atau gunakan aturan pointing domain ke folder `public`.
|
|
|
|
## 3) Konfigurasi `.env` untuk produksi
|
|
Ubah nilai berikut sesuai hosting:
|
|
|
|
```env
|
|
APP_NAME="Absensi TA"
|
|
APP_ENV=production
|
|
APP_DEBUG=false
|
|
APP_URL=https://domain-anda.com
|
|
|
|
DB_CONNECTION=mysql
|
|
DB_HOST=localhost
|
|
DB_PORT=3306
|
|
DB_DATABASE=nama_database
|
|
DB_USERNAME=username_database
|
|
DB_PASSWORD=password_database
|
|
|
|
CACHE_STORE=file
|
|
QUEUE_CONNECTION=sync
|
|
SESSION_DRIVER=file
|
|
FILESYSTEM_DISK=local
|
|
```
|
|
|
|
## 4) Jalankan perintah setelah upload
|
|
Karena Anda deploy lewat FTP, perintah berikut biasanya perlu dijalankan via panel hosting / SSH (kalau tersedia):
|
|
|
|
```bash
|
|
php artisan key:generate
|
|
php artisan config:clear
|
|
php artisan config:cache
|
|
php artisan route:cache
|
|
php artisan view:cache
|
|
php artisan migrate --force
|
|
php artisan storage:link
|
|
```
|
|
|
|
## 5) Atur izin folder
|
|
Pastikan folder berikut writable:
|
|
- `storage/`
|
|
- `bootstrap/cache/`
|
|
|
|
Biasanya set permission:
|
|
- `storage/` = 775 atau 777 (tergantung hosting)
|
|
- `bootstrap/cache/` = 775 atau 777
|
|
|
|
## 6) Jika domain tidak langsung mengarah ke folder `public`
|
|
Buat file `.htaccess` di root hosting dengan isi seperti ini:
|
|
|
|
```apache
|
|
<IfModule mod_rewrite.c>
|
|
RewriteEngine On
|
|
RewriteRule ^(.*)$ public/$1 [L]
|
|
</IfModule>
|
|
```
|
|
|
|
## 7) Tips penting
|
|
- Jangan upload file `.env.example` ke produksi.
|
|
- Setelah upload, pastikan file `public/index.php` benar-benar dipakai sebagai entry point.
|
|
- Jika ada error 500, cek log error hosting atau file `storage/logs/`.
|