Banyak banget yang kerepotan install projek laravel di cyberpanel.
Saya bagikan pengalaman saya, semoga membantu …
1. Pertama, Uploud file projek laravelnya ke public_html. Bisa pakai file manager atau ftp
2. Atur Permission storage dan bostrap/cache menjadi 775
Bisa menggunakan tombol permission di cyberpanel atau pakai perintah berikut jika pakai ssh / terminal:
chmod -R 775 storage chmod -R 775 bootstrap/cache
3. Agar akses url nya tidak perlu menggunakan /public ( sering mengalami kendala ini, projek bisa diakses jika pakai imbuan /public)
Caranya, buat file index.php dan .htacces di folder public_html
code .htacces
<IfModule mod_rewrite.c> RewriteEngine On # Redirect all requests to the public directory RewriteRule ^(.*)$ public/\ [L] </IfModule>
code index.php
<?php /** * Laravel - A PHP Framework For Web Artisans * * @package Laravel * @author Taylor Otwell <[email protected]> */ define('LARAVEL_START', microtime(true)); /* |-------------------------------------------------------------------------- | Register The Auto Loader |-------------------------------------------------------------------------- | | Composer provides a convenient, automatically generated class loader | for our application. We just need to utilize it! We'll simply require | it into the script here so we don't need to manually load our classes. | */ require __DIR__.'/public/index.php';
kemudian ubah .htaccess di folder public sebagai berikut
<IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews -Indexes </IfModule> RewriteEngine On # Handle Authorization Header RewriteCond %{HTTP:Authorization} . RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] # Redirect Trailing Slashes If Not A Folder... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} (.+)/$ RewriteRule ^ %1 [L,R=301] # Send Requests To Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] </IfModule>
Cek disini detailnya https://github.com/cahrur/install-laravel-di-cyberpanel
Done .. Semoga berhasil!!
Tambahan :
Untuk symbolic link storage laravel di cyberpanel, jika ada masalah versi php tidak sesuai antara cli / hosting dan projek, bisa gunakan command berikut
/usr/local/lsws/lsphp82/bin/php artisan storage:link
ubah lsphp82 sesuai dengan versi php yang diinginkan