Laravel / Pemrograman Web Lanjut · August 9, 2022

Upload Project Laravel ke Dalam Hosting dengan Cpanel #12

image_pdf

Setelah selesai dalam membuat project dengan laravel 9 makan fokus selanjutnya adalah untuk Upload kedalam hosting.

Untuk tahap awal silahkan terlebih dahulu menyiapkan domain dan hstingnya terlebih dahulu di nusantarahost.com

Langkah selanjutnya upload file yang sudah disiapkan dalam bentuk *.zip

Proses zip aplikasi

Selanjutnya buat folder baru yaitu laravel pada Cpanel

Membuat folder laravel pada Cpanel

Upload file yang sudah di zip didalam folder laravel

Upload file pada folder laravel

Lakukan setting pada direktori penyimpanan aplikasi

Buat folder baru bernama laravel pada direktori utama

Menambah folder laravel pada direktori home

Selanjutnya, pindahkan semua isi file pada direktori laravel sebelumnya kecuali folder public

Isi dari folder laravel yang ada pada direktori home

pindahkan semua isi pada folder public di dalam direktori public_html

Isi file dalam folder subdomain laravel.ruangdigital.net

Lakukan setting pada file index.html yang ada pada folder subdomain seperti code berikut

<?php

use Illuminate\Contracts\Http\Kernel;
use Illuminate\Http\Request;

define('LARAVEL_START', microtime(true));

/*
|--------------------------------------------------------------------------
| Check If The Application Is Under Maintenance
|--------------------------------------------------------------------------
|
| If the application is in maintenance / demo mode via the "down" command
| we will load this file so that any pre-rendered content can be shown
| instead of starting the framework, which could cause an exception.
|
*/

if (file_exists($maintenance = __DIR__.'/../laravel/storage/framework/maintenance.php')) {
    require $maintenance;
}

/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| this 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__.'/../laravel/vendor/autoload.php';

/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request using
| the application's HTTP kernel. Then, we will send the response back
| to this client's browser, allowing them to enjoy our application.
|
*/

$app = require_once __DIR__.'/../laravel/bootstrap/app.php';

$kernel = $app->make(Kernel::class);

$response = $kernel->handle(
    $request = Request::capture()
)->send();

$kernel->terminate($request, $response);

Silahkan cek pada url yang anda setting https://laravel.ruangdigital.net/

Halaman home aplikasi website yang kita miliki