diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md index e809222..04d35ed 100644 --- a/DEPLOYMENT.md +++ b/DEPLOYMENT.md @@ -76,9 +76,69 @@ composer dump-autoload --optimize - Enable `extension=mbstring` - Memory limit: 256M (minimum) -3. **Nginx/Apache Config**: - - Enable rewrite rules - - Point to `public/` directory +3. **Nginx Configuration** (PENTING untuk fix 404): + + Masuk ke: **Website -> api.btekno.cloud -> Settings -> Configuration** + + Ganti isi configuration dengan: + ```nginx + server { + listen 80; + listen 443 ssl http2; + server_name api.btekno.cloud; + + # Document Root - HARUS ke folder public/ + root /www/wwwroot/api.btekno.cloud/api/public; + index index.php index.html; + + # Logs + access_log /www/wwwlogs/api.btekno.cloud.log; + error_log /www/wwwlogs/api.btekno.cloud.error.log; + + # Disable access to hidden files + location ~ /\. { + deny all; + access_log off; + log_not_found off; + } + + # Main location block - routing untuk Slim Framework + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + # PHP-FPM configuration + location ~ \.php$ { + try_files $uri =404; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass unix:/tmp/php-cgi-83.sock; # Sesuaikan dengan PHP version (83, 82, dll) + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include fastcgi_params; + + # Disable buffering for SSE + fastcgi_buffering off; + } + + # Disable PHP execution in uploads + location ~* /uploads/.*\.php$ { + deny all; + } + } + ``` + + **Cek PHP socket path:** + ```bash + # Cek PHP version yang digunakan + php -v + + # Cek socket path (biasanya di /tmp/php-cgi-XX.sock) + ls -la /tmp/php-cgi-*.sock + ``` + + Setelah edit, klik **Save** dan **Reload** nginx. + + **Atau copy file `nginx.conf.example` dan sesuaikan path PHP socket.** ## 🔧 Environment Configuration