Update Server, Install Apache, Buat file index.html
Pertama, kita update servernya dengan perintah:
yum -y update
Install Apache dan nano
yum -y install httpd nano
Jalankan service Apache dan set agar berjalan otomatis saat server di menyala.
systemctl start httpd systemctl enable httpd
baris pertama untuk menjalankan service Apache, baris kedua untuk mendaftarkan service Apache ke autorun saat server di restart.
Jangan lupa�membuka firewall untuk koneksi http dengan menjalankan perintah:
firewall-cmd --permanent --zone=public --add-service=http firewall-cmd --reload
Untuk mengeceknya bisa menjalankan perintah
firewall-cmd --list-all
dan akan muncul
public (active) target: default icmp-block-inversion: no interfaces: eth0 sources: services: ssh dhcpv6-client http ports: protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules:
Sekarang�kita coba buka web browser dan akses http://11.22.33.44 atau http://oprek.karedok.net seharusnya akan muncul halaman seperti berikut:
Buat file konfigurasi VirtualHost Apache
Kita akan membuat file virtualhost agar apache bisa mengenali request ke domain tersebut.
nano /etc/httpd/conf.d/oprek.conf
Isi dengan
<VirtualHost *:80> ServerName oprek.karedok.net DocumentRoot /var/www/karedok <Directory /var/www/karedok> Require all granted </Directory> </VirtualHost>
Cek konfigurasi Apache
httpd -t
Kalau hasilnya sudah�Syntax OK , restart service apache.
systemctl restart httpd
Buat file index.html di dalam direktori /var/www/karedok dan kita akan tampilkan�Hello World! saat diakses.
mkdir /var/www/karedok cd /var/www/karedok/ touch index.html echo "<h1>Hello World</h1>" > index.html
Lalu buka web browser dan coba akses http://oprek.karedok.net seharusnya akan terbuka halaman dengan tulisan�Hello World!