Install Apache Centos 7
Install Apache Centos 7 – Artikel kali ini akan membahas cara Install Apache Centos 7
Untuk cara Install Centos 7, anda bisa melihat artikelnya disini.
Install Apache Centos 7
Update Repository
1 2 3 4 |
sudo yum clean all sudo yum -y update |
Install Apache
1 2 3 4 |
sudo yum -y install curl sudo yum -y install httpd |
Selanjutnya edit file httpd.conf dan tambahan di baris pertama paling awal konfigurasi berikut:
1 2 3 4 5 |
sudo cp /etc/httpd/conf/httpd.conf{,._orig} sudo cp /etc/httpd/conf/httpd.conf{,.`date +%Y%m%d-%H%M%S`} sudo vi /etc/httpd/conf/httpd.conf |
1 2 3 |
ServerName localhost |
Buat file index.html dengan perintah berikut:
1 2 3 |
echo "<h1>Ini website Centos 7</h1>" > /var/www/html/index.html |
Kemudian jalankan apache dengan perintah berikut:
1 2 3 4 |
sudo systemctl start httpd sudo systemctl enable httpd |
Cek Status Apache
Setelah proses instalasi selesai, kita bisa cek status Apache dengan perintah sebagai berikut:
1 2 3 |
sudo systemctl status httpd |
Untuk me-restart apache gunakan perintah berikut:
1 2 3 |
sudo systemctl restart httpd |
Testing Apache
Disini untuk menguji apache kita menggunakan curl:
1 2 3 |
curl -I http://localhost |
1 2 3 4 5 6 7 8 9 10 |
HTTP/1.1 200 OK Date: Tue, 30 Apr 2019 14:54:57 GMT Server: Apache/2.4.6 (CentOS) Last-Modified: Tue, 19 Jun 2018 14:54:49 GMT ETag: "1e-587c0952de5af" Accept-Ranges: bytes Content-Length: 30 Content-Type: text/html; charset=UTF-8 |
1 2 3 |
curl http://localhost |
1 2 3 |
<h1>Ini website Centos 7</h1> |
Apache LOG
Untuk melihat log access dan error, gunakan perintah berikut:
1 2 3 4 |
tail -f /var/log/httpd/access_log tail -f /var/log/httpd/error_log |
Sampai disini cara Install Apache Centos 7 sudah selesai. Pada kesempatan lain kita akan bahas tentang Apache lebih mendalam lagi.
Semoga bermanfaat