Kali ini kami akan memberikan tips Cara Menginstal Server Web Apache di Ubuntu 20.04. Ini bisa anda gunakan sebagai webserver di vps , ataupun bisa anda gunakan di desktop, tapi kami sarakan untuk vps anda bisa gunakan combinasi antara apache dan nginx, kalau apache saja lebih disarankan untuk develop saja di local atau di laptop anda.
Untuk install apache anda bisa melakukan perintah dibawah ini

Perintah untuk install Apache

sudo apt install apache2

Perintah Untuk Cek Apache

Setelah itu Apache akan terinstall di computer anda. Anda bisa mengeceknya dengan perintah dibawah ini

sudo systemctl status apache2

Perintah perintah untuk apache di ubuntu

sudo systemctl stop apache2
sudo systemctl start apache2
sudo systemctl restart apache2
sudo systemctl reload apache2
sudo systemctl disable apache2
sudo systemctl enable apache2

Cara Merubah Default Folder

Langkah  Pertama Edit File Berikut

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

Stelah itu Edit Document Root Menjadi target baru yang anda inginkan

DocumentRoot "/targetbaru/folder"

Langkah selanjutnya Edit pada File Berikut

sudo nano /etc/apache2/apache2.conf

Cari Kode yang mirip seperti dibawah ini

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>

Setelah Ketemu , silhkan tambahkan kode berikut

<Directory "/targetbaru/folder>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
<Directory>

Merubah Default User Untuk Apache

Edit Pada File Berikut ini

sudo nano /etc/apache2/envvars

Ubah User Menjadi 


export APACHE_RUN_USER=pithu7
export APACHE_RUN_GROUP=pithu7

Setelah selesai semuanya , anda bisa restart Apache

sudo systemctl restart apache2

Instal PHP

sudo apt install php libapache2-mod-php
sudo systemctl restart apache2

 

Install Mysql Server

sudo apt install mysql-server

sudo mysql_secure_installation

sudo mysql -u root -p

Membuat User


CREATE USER 'admin'@'localhost' IDENTIFIED BY 'password';

Edit Password


ALTER USER 'admin'@'localhost' IDENTIFIED BY 'newpassword';

FLUSH PRIVILEGES

Set Grand Previlage


GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;

Delete User

DROP USER 'admin'@'localhost';

Delete Previlage

REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'admin'@'localhost';

Delete Database

DROP DATABASE dbname;

Install PHPMYADMIN

sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl

Semoga Membantu