{"id":2228,"date":"2018-10-30T23:05:37","date_gmt":"2018-10-30T16:05:37","guid":{"rendered":"https:\/\/www.linuxid.net\/post\/?p=2228"},"modified":"2025-03-25T05:14:40","modified_gmt":"2025-03-24T22:14:40","slug":"cara-install-dan-konfigurasi-apache-di-centos-7","status":"publish","type":"post","link":"https:\/\/www.linuxid.net\/post\/cara-install-dan-konfigurasi-apache-di-centos-7\/","title":{"rendered":"Cara Install dan Konfigurasi Apache di CentOS 7"},"content":{"rendered":"<p>Apache HTTP server adalah server web yang paling banyak digunakan di dunia. Apache menyediakan banyak fitur canggih termasuk modul yang dapat dimuat secara dinamis, dukungan media yang kuat, dan integrasi luas dengan perangkat lunak populer lainnya.<\/p>\n<p>Sebelum Anda memulai panduan ini, Anda harus memiliki pengguna biasa, non-root dengan <a href=\"https:\/\/www.linuxid.net\/25222\/cara-membuat-user-sudo-di-centos\/\">wewenang sudo<\/a> yang dikonfigurasi di server Anda.<\/p>\n<p>Kami sarankan Anda untuk menguji setiap tutorial atau panduan yang ada di Internet di virtual machine (<a href=\"https:\/\/www.linuxid.net\/25781\/cara-install-vmware-workstation-player-di-centos-7\/\">vmware<\/a> atau <a href=\"https:\/\/www.linuxid.net\/25783\/cara-install-oracle-virtualbox-di-centos-7\/\">virtualbox<\/a>) sebelum menerapkan ke server produksi, agar tidak mengacaukan sistem yang berjalan ketika ada kesalahan.<\/p>\n<h2>Langkah 1 \u2014 Instal Apache<\/h2>\n<p>Apache tersedia dalam repositori default CentOS, sehingga memungkinkan untuk menginstalnya menggunakan alat manajemen paket konvensional.<\/p>\n<p>Pada CentOS dan RHEL paket Apache dan layanannya disebut httpd. Untuk menginstal paket, jalankan perintah berikut:<\/p>\n<pre>sudo yum install httpd<\/pre>\n<p>Setelah instalasi selesai, aktifkan dan mulai layanan Apache:<\/p>\n<pre>sudo systemctl enable httpd\r\nsudo systemctl start httpd<\/pre>\n<h2>Mengatur Firewall di CentOS 7<\/h2>\n<p>Jika server Anda <a href=\"https:\/\/www.linuxid.net\/26001\/cara-mengatur-firewall-dengan-firewalld-di-centos-7\">dilindungi oleh firewall<\/a>, Anda perlu membuka port <code>HTTP<\/code> dan <code>HTTPS<\/code>, <code>80<\/code> dan <code>443<\/code>. Gunakan perintah berikut untuk membuka port yang diperlukan:<\/p>\n<pre>sudo firewall-cmd --permanent --zone=public --add-service=http\r\nsudo firewall-cmd --permanent --zone=public --add-service=https\r\nsudo firewall-cmd --reload<\/pre>\n<h2>Verifikasi instalasi Apache<\/h2>\n<p>Sekarang kita telah menginstal dan menjalankan Apache pada server CentOS 7, kita dapat memeriksa status dan versi layanan Apache, dengan menggunakan perintah :<\/p>\n<pre>sudo systemctl status httpd<\/pre>\n<pre>\u25cf httpd.service - The Apache HTTP Server\r\n   Loaded: loaded (\/usr\/lib\/systemd\/system\/httpd.service; enabled; vendor preset: disabled)\r\n   Active: active (running) since Thu 2018-04-26 07:13:07 UTC; 11s ago\r\n     Docs: man:httpd(8)\r\n           man:apachectl(8)\r\n Main PID: 3049 (httpd)\r\n   Status: \"Total requests: 0; Current requests\/sec: 0; Current traffic:   0 B\/sec\"\r\n   CGroup: \/system.slice\/httpd.service\r\n           \u251c\u25003049 \/usr\/sbin\/httpd -DFOREGROUND\r\n           \u251c\u25003050 \/usr\/sbin\/httpd -DFOREGROUND\r\n           \u251c\u25003051 \/usr\/sbin\/httpd -DFOREGROUND\r\n           \u251c\u25003052 \/usr\/sbin\/httpd -DFOREGROUND\r\n           \u251c\u25003053 \/usr\/sbin\/httpd -DFOREGROUND\r\n           \u2514\u25003054 \/usr\/sbin\/httpd -DFOREGROUND<\/pre>\n<p>Kemudian lihat juga versi yang terinstall dengan menggunakan perintah :<\/p>\n<pre>sudo httpd -v<\/pre>\n<pre>Server version: Apache\/2.4.6 (CentOS)\r\nServer built:   Oct 19 2017 20:39:16<\/pre>\n<p>Terakhir, untuk memverifikasi apakah semuanya berfungsi dengan baik, buka domain atau alamat IP server Anda di browser pilihan Anda, dan Anda akan melihat halaman selamat datang default Apache CentOS 7 seperti yang ditunjukkan di bawah ini:<\/p>\n<p><a href=\"https:\/\/www.linuxid.net\/assets\/media\/how-to\/tutorial\/25991\/apache-welcome-page.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-26004\" src=\"https:\/\/www.linuxid.net\/assets\/media\/apache-welcome-page-750x386.jpg\" alt=\"apache CentOS welcome page\" width=\"696\" height=\"358\" \/><\/a><\/p>\n<h2>Manajemen Proses Apache<\/h2>\n<p>Sekarang setelah web server Anda telah aktif dan berjalan, mari membahas beberapa perintah manajemen dasar.<\/p>\n<p>Untuk menghentikan server web, ketik<\/p>\n<pre>sudo systemctl <code>stop<\/code> httpd<\/pre>\n<p>Untuk memulai server web saat berhenti, ketik:<\/p>\n<pre>sudo systemctl <code>start<\/code> httpd<\/pre>\n<p>Untuk menghentikan dan kemudian memulai lagi layanan, ketik:<\/p>\n<pre>sudo systemctl <code>restart<\/code> httpd<\/pre>\n<p>Jika Anda hanya membuat perubahan konfigurasi, Apache dapat memuat ulang aplikasi tanpa menjatuhkan koneksi. Untuk melakukan ini, gunakan perintah :<\/p>\n<pre>sudo systemctl <code>reload<\/code> httpd<\/pre>\n<p>Secara default, Apache dikonfigurasi untuk memulai secara otomatis ketika server melakukan booting. Jika ini bukan yang Anda inginkan, nonaktifkan perilaku ini dengan mengetik:<\/p>\n<pre>sudo systemctl <code>disable<\/code> httpd<\/pre>\n<p>Untuk mengaktifkan kembali layanan untuk memulai saat boot, ketik:<\/p>\n<pre>sudo systemctl <code>enable<\/code> httpd<\/pre>\n<p>Apache sekarang akan mulai secara otomatis ketika server melakukan booting kembali.<\/p>\n<h2>Pengaturan Dasar Apache di CentOS<\/h2>\n<p>Berikut adalah pengaturan dasar Apache di CentOS, jika Anda mengalami masalah, atau ingin mengubah konfigurasi, inilah tempat yang akan Anda cari :<\/p>\n<ul>\n<li>Semua File konfigurasi Apache berada di direktori\u00a0<code>\/etc\/httpd<\/code>.<\/li>\n<li>File konfigurasi utama Apache adalah <code>\/etc\/httpd\/conf\/httpd.conf<\/code>.<\/li>\n<li>File konfigurasi yang bertanggung jawab untuk memuat berbagai modul Apache terdapat di direktori <code>\/etc\/httpd\/conf.modules.d<\/code>.<\/li>\n<li>Untuk pemeliharaan yang lebih baik disarankan untuk membuat file konfigurasi terpisah (vhost) untuk setiap domain.<\/li>\n<li>Apache virtual host harus berakhiran dengan ekstensi <code>.conf<\/code> dan terletak di direktori\u00a0<code>\/etc\/httpd\/conf.d<\/code><\/li>\n<li>Sangat disarankan untuk mengikuti konvensi penamaan standar, misalnya jika nama domain situs ini adalah\u00a0<code>beritabebas.com<\/code>, maka file konfigurasi domain dinamai\u00a0<code>\/etc\/httpd\/conf.d\/beritabebas.com.conf<\/code>\u00a0untuk memudahkan manajemen situs.<\/li>\n<li>File log Apache (<code>access.log<\/code>\u00a0dan\u00a0<code>error.log<\/code>) terletak di direktori\u00a0<code>\/var\/log\/httpd<\/code>. Disarankan untuk menggunakan file\u00a0<code>access<\/code>\u00a0dan\u00a0<code>error<\/code>\u00a0log yang berbeda untuk setiap virtual host .<\/li>\n<li>Anda dapat mengatur direktori root dokumen domain Anda ke lokasi yang Anda inginkan. Lokasi yang paling umum untuk webroot meliputi:\n<ul>\n<li><code>\/home\/&lt;user_name&gt;\/&lt;site_name&gt;<\/code><\/li>\n<li><code>\/var\/www\/&lt;site_name&gt;<\/code><\/li>\n<li><code>\/var\/www\/html\/&lt;site_name&gt;<\/code><\/li>\n<li><code>\/opt\/&lt;site_name&gt;<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>Kesimpulan<\/h2>\n<p>Anda telah berhasil menginstal Apache di server CentOS 7. Anda sekarang siap untuk mulai deploy aplikasi Anda dan menggunakan Apache sebagai web atau server proxy.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Apache HTTP server adalah server web yang paling banyak digunakan di dunia. Apache menyediakan banyak&hellip;<\/p>\n","protected":false},"author":2,"featured_media":2229,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[38,77],"class_list":["post-2228","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","tag-apache","tag-centos-7"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Cara Install dan Konfigurasi Apache di CentOS 7 - Linuxid<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.linuxid.net\/post\/cara-install-dan-konfigurasi-apache-di-centos-7\/\" \/>\n<meta property=\"og:locale\" content=\"id_ID\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Cara Install dan Konfigurasi Apache di CentOS 7 - Linuxid\" \/>\n<meta property=\"og:description\" content=\"Apache HTTP server adalah server web yang paling banyak digunakan di dunia. Apache menyediakan banyak&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.linuxid.net\/post\/cara-install-dan-konfigurasi-apache-di-centos-7\/\" \/>\n<meta property=\"og:site_name\" content=\"Linuxid\" \/>\n<meta property=\"article:published_time\" content=\"2018-10-30T16:05:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-03-24T22:14:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.linuxid.net\/post\/wp-content\/uploads\/2025\/03\/Cara-Install-dan-Konfigurasi-Apache-di-CentOS-7.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"530\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"xsand\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Ditulis oleh\" \/>\n\t<meta name=\"twitter:data1\" content=\"xsand\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimasi waktu membaca\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 menit\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.linuxid.net\/post\/cara-install-dan-konfigurasi-apache-di-centos-7\/\",\"url\":\"https:\/\/www.linuxid.net\/post\/cara-install-dan-konfigurasi-apache-di-centos-7\/\",\"name\":\"Cara Install dan Konfigurasi Apache di CentOS 7 - Linuxid\",\"isPartOf\":{\"@id\":\"https:\/\/linuxid.net\/post\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.linuxid.net\/post\/cara-install-dan-konfigurasi-apache-di-centos-7\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.linuxid.net\/post\/cara-install-dan-konfigurasi-apache-di-centos-7\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.linuxid.net\/post\/wp-content\/uploads\/2025\/03\/Cara-Install-dan-Konfigurasi-Apache-di-CentOS-7.jpg\",\"datePublished\":\"2018-10-30T16:05:37+00:00\",\"dateModified\":\"2025-03-24T22:14:40+00:00\",\"author\":{\"@id\":\"https:\/\/linuxid.net\/post\/#\/schema\/person\/e6642d26041eab9fef2677e204e89d79\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.linuxid.net\/post\/cara-install-dan-konfigurasi-apache-di-centos-7\/#breadcrumb\"},\"inLanguage\":\"id\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.linuxid.net\/post\/cara-install-dan-konfigurasi-apache-di-centos-7\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"id\",\"@id\":\"https:\/\/www.linuxid.net\/post\/cara-install-dan-konfigurasi-apache-di-centos-7\/#primaryimage\",\"url\":\"https:\/\/www.linuxid.net\/post\/wp-content\/uploads\/2025\/03\/Cara-Install-dan-Konfigurasi-Apache-di-CentOS-7.jpg\",\"contentUrl\":\"https:\/\/www.linuxid.net\/post\/wp-content\/uploads\/2025\/03\/Cara-Install-dan-Konfigurasi-Apache-di-CentOS-7.jpg\",\"width\":1000,\"height\":530},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.linuxid.net\/post\/cara-install-dan-konfigurasi-apache-di-centos-7\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Beranda\",\"item\":\"https:\/\/linuxid.net\/post\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Cara Install dan Konfigurasi Apache di CentOS 7\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/linuxid.net\/post\/#website\",\"url\":\"https:\/\/linuxid.net\/post\/\",\"name\":\"Linuxid\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/linuxid.net\/post\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"id\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/linuxid.net\/post\/#\/schema\/person\/e6642d26041eab9fef2677e204e89d79\",\"name\":\"xsand\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"id\",\"@id\":\"https:\/\/linuxid.net\/post\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cc8513768e15fa0758099a0ba5b898f3?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cc8513768e15fa0758099a0ba5b898f3?s=96&d=mm&r=g\",\"caption\":\"xsand\"},\"url\":\"https:\/\/www.linuxid.net\/post\/author\/xsand\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Cara Install dan Konfigurasi Apache di CentOS 7 - Linuxid","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.linuxid.net\/post\/cara-install-dan-konfigurasi-apache-di-centos-7\/","og_locale":"id_ID","og_type":"article","og_title":"Cara Install dan Konfigurasi Apache di CentOS 7 - Linuxid","og_description":"Apache HTTP server adalah server web yang paling banyak digunakan di dunia. Apache menyediakan banyak&hellip;","og_url":"https:\/\/www.linuxid.net\/post\/cara-install-dan-konfigurasi-apache-di-centos-7\/","og_site_name":"Linuxid","article_published_time":"2018-10-30T16:05:37+00:00","article_modified_time":"2025-03-24T22:14:40+00:00","og_image":[{"width":1000,"height":530,"url":"https:\/\/www.linuxid.net\/post\/wp-content\/uploads\/2025\/03\/Cara-Install-dan-Konfigurasi-Apache-di-CentOS-7.jpg","type":"image\/jpeg"}],"author":"xsand","twitter_card":"summary_large_image","twitter_misc":{"Ditulis oleh":"xsand","Estimasi waktu membaca":"3 menit"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.linuxid.net\/post\/cara-install-dan-konfigurasi-apache-di-centos-7\/","url":"https:\/\/www.linuxid.net\/post\/cara-install-dan-konfigurasi-apache-di-centos-7\/","name":"Cara Install dan Konfigurasi Apache di CentOS 7 - Linuxid","isPartOf":{"@id":"https:\/\/linuxid.net\/post\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.linuxid.net\/post\/cara-install-dan-konfigurasi-apache-di-centos-7\/#primaryimage"},"image":{"@id":"https:\/\/www.linuxid.net\/post\/cara-install-dan-konfigurasi-apache-di-centos-7\/#primaryimage"},"thumbnailUrl":"https:\/\/www.linuxid.net\/post\/wp-content\/uploads\/2025\/03\/Cara-Install-dan-Konfigurasi-Apache-di-CentOS-7.jpg","datePublished":"2018-10-30T16:05:37+00:00","dateModified":"2025-03-24T22:14:40+00:00","author":{"@id":"https:\/\/linuxid.net\/post\/#\/schema\/person\/e6642d26041eab9fef2677e204e89d79"},"breadcrumb":{"@id":"https:\/\/www.linuxid.net\/post\/cara-install-dan-konfigurasi-apache-di-centos-7\/#breadcrumb"},"inLanguage":"id","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.linuxid.net\/post\/cara-install-dan-konfigurasi-apache-di-centos-7\/"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https:\/\/www.linuxid.net\/post\/cara-install-dan-konfigurasi-apache-di-centos-7\/#primaryimage","url":"https:\/\/www.linuxid.net\/post\/wp-content\/uploads\/2025\/03\/Cara-Install-dan-Konfigurasi-Apache-di-CentOS-7.jpg","contentUrl":"https:\/\/www.linuxid.net\/post\/wp-content\/uploads\/2025\/03\/Cara-Install-dan-Konfigurasi-Apache-di-CentOS-7.jpg","width":1000,"height":530},{"@type":"BreadcrumbList","@id":"https:\/\/www.linuxid.net\/post\/cara-install-dan-konfigurasi-apache-di-centos-7\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Beranda","item":"https:\/\/linuxid.net\/post\/"},{"@type":"ListItem","position":2,"name":"Cara Install dan Konfigurasi Apache di CentOS 7"}]},{"@type":"WebSite","@id":"https:\/\/linuxid.net\/post\/#website","url":"https:\/\/linuxid.net\/post\/","name":"Linuxid","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/linuxid.net\/post\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"id"},{"@type":"Person","@id":"https:\/\/linuxid.net\/post\/#\/schema\/person\/e6642d26041eab9fef2677e204e89d79","name":"xsand","image":{"@type":"ImageObject","inLanguage":"id","@id":"https:\/\/linuxid.net\/post\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cc8513768e15fa0758099a0ba5b898f3?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cc8513768e15fa0758099a0ba5b898f3?s=96&d=mm&r=g","caption":"xsand"},"url":"https:\/\/www.linuxid.net\/post\/author\/xsand\/"}]}},"_links":{"self":[{"href":"https:\/\/www.linuxid.net\/post\/wp-json\/wp\/v2\/posts\/2228","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.linuxid.net\/post\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxid.net\/post\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxid.net\/post\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxid.net\/post\/wp-json\/wp\/v2\/comments?post=2228"}],"version-history":[{"count":1,"href":"https:\/\/www.linuxid.net\/post\/wp-json\/wp\/v2\/posts\/2228\/revisions"}],"predecessor-version":[{"id":2419,"href":"https:\/\/www.linuxid.net\/post\/wp-json\/wp\/v2\/posts\/2228\/revisions\/2419"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.linuxid.net\/post\/wp-json\/wp\/v2\/media\/2229"}],"wp:attachment":[{"href":"https:\/\/www.linuxid.net\/post\/wp-json\/wp\/v2\/media?parent=2228"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxid.net\/post\/wp-json\/wp\/v2\/categories?post=2228"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxid.net\/post\/wp-json\/wp\/v2\/tags?post=2228"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}