0% found this document useful (0 votes)
19 views

Buka Terminal: # Tambahkan Di Bawahnya

The document provides instructions for setting up a Laravel project on an Ubuntu server. It includes steps to install Laravel using the Laravel installer, configure Apache virtual hosts to point to the Laravel public directory, set file permissions for storage, enable Apache rewrite modules, and create an .htaccess file for URL rewriting.

Uploaded by

Fatkhur Rohman
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Buka Terminal: # Tambahkan Di Bawahnya

The document provides instructions for setting up a Laravel project on an Ubuntu server. It includes steps to install Laravel using the Laravel installer, configure Apache virtual hosts to point to the Laravel public directory, set file permissions for storage, enable Apache rewrite modules, and create an .htaccess file for URL rewriting.

Uploaded by

Fatkhur Rohman
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Buka terminal

~$ pwd

Note: Output: /home/ubuntu Jika tidak maka

~$ cd /home/ubuntu (Note: skip jika output ==^)

~$ laravel new myapp (tunggu sampai selesai)

Note: myapp (sesuaikan dengan nama projek yang dibuat)

~$ rm -rf public_html/*

~$ cp -rf myapp/public/* public_html/

Edit file public_html/index.php

Cari -> require __DIR__.'/../vendor/autoload.php'; (Line 24)

Jadi -> require '../myapp/vendor/autoload.php';

Cari -> $app = require_once __DIR__.'/../bootstrap/app.php'; (Line 38)

Jadi -> $app = require_once '../myapp/bootstrap/app.php';

Note: myapp (sesuaikan dengan nama projek yang dibuat)

~$ sudo -i

~# chmod -R 777 /home/ubuntu/myapp/storage

~# apt update && apt install nano (tunggu sampai selesai)

~# nano /etc/apache2/sites-available/000-default.conf

# Cari -> DocumentRoot /var/www/html

# Ubah -> DocumentRoot /home/ubuntu/public_html

# Tambahkan di bawahnya
<Directory “/home/ubuntu/public_html”>

Order deny, allow

Allow from all

Allowoverride all

</Directory>

# Simpan dengan click CTRL+X -> (Y) Yest -> Enter

~# nano /etc/apache2/sites-available/default-ssl.conf

# Cari -> DocumentRoot /var/www/html

# Ubah -> DocumentRoot /home/ubuntu/public_html

# Tambahkan di bawahnya

<Directory “/home/ubuntu/public_html”>

Order deny, allow

Allow from all

Allowoverride all

</Directory>

# Simpan dengan click CTRL+X -> (Y) Yest -> Enter

~# a2enmod rewrite

~# a2ensite default-ssl.conf

~# service apache2 restart

~# exit

~$ touch /home/ubuntu/public_html/.htaccess

~$ nano /home/ubuntu/public_html/.htaccess
# Masukkan script di bawah ke .htaccess

<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]

# Handle Front Controller...

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^ index.php [L]

</IfModule>

# Simpan dengan click CTRL+X -> (Y) Yest -> Enter

## Selamat mencoba ##

You might also like