Add fix guide untuk redirect loop di server production
This commit is contained in:
82
FIX_REDIRECT_LOOP.md
Normal file
82
FIX_REDIRECT_LOOP.md
Normal file
@@ -0,0 +1,82 @@
|
||||
# Fix Redirect Loop - Masalah di Server Production
|
||||
|
||||
## Masalah
|
||||
|
||||
Dari curl test:
|
||||
```
|
||||
HTTP/2 302
|
||||
location: ../index.php
|
||||
```
|
||||
|
||||
Ada redirect PHP ke `../index.php` yang menyebabkan loop.
|
||||
|
||||
## Penyebab
|
||||
|
||||
Kemungkinan besar ada **file PHP di root** atau **konfigurasi server** yang melakukan redirect.
|
||||
|
||||
## Solusi
|
||||
|
||||
### 1. Cek File di Root Server
|
||||
|
||||
Di server production, cek apakah ada file `index.php` di root:
|
||||
|
||||
```bash
|
||||
cd /www/wwwroot/retribusi.btekno.cloud/retribusi
|
||||
ls -la index.php
|
||||
```
|
||||
|
||||
Jika ada, **HAPUS** file tersebut karena sekarang `index.php` sudah di folder `public/`.
|
||||
|
||||
### 2. Cek Konfigurasi Nginx
|
||||
|
||||
Pastikan document root mengarah ke folder `public/`:
|
||||
|
||||
```bash
|
||||
# Cek konfigurasi nginx
|
||||
cat /etc/nginx/sites-available/retribusi.btekno.cloud
|
||||
# atau
|
||||
cat /etc/nginx/conf.d/retribusi.conf
|
||||
```
|
||||
|
||||
Pastikan ada:
|
||||
```nginx
|
||||
root /www/wwwroot/retribusi.btekno.cloud/retribusi/public;
|
||||
```
|
||||
|
||||
**BUKAN**:
|
||||
```nginx
|
||||
root /www/wwwroot/retribusi.btekno.cloud/retribusi; # SALAH!
|
||||
```
|
||||
|
||||
### 3. Hapus File index.php di Root (jika ada)
|
||||
|
||||
```bash
|
||||
cd /www/wwwroot/retribusi.btekno.cloud/retribusi
|
||||
rm -f index.php # Hapus jika ada
|
||||
```
|
||||
|
||||
### 4. Reload Nginx
|
||||
|
||||
Setelah update konfigurasi:
|
||||
|
||||
```bash
|
||||
nginx -t # Test konfigurasi
|
||||
nginx -s reload # Reload nginx
|
||||
```
|
||||
|
||||
### 5. Test Lagi
|
||||
|
||||
```bash
|
||||
curl -I https://retribusi.btekno.cloud/index.php
|
||||
```
|
||||
|
||||
Seharusnya sekarang tidak ada redirect 302 lagi.
|
||||
|
||||
## Checklist
|
||||
|
||||
- [ ] Tidak ada `index.php` di root `/retribusi/`
|
||||
- [ ] Document root nginx mengarah ke `/retribusi/public`
|
||||
- [ ] Nginx sudah di-reload
|
||||
- [ ] Test curl tidak ada redirect 302
|
||||
- [ ] Browser cache sudah di-clear
|
||||
|
||||
Reference in New Issue
Block a user