{"id":34888,"date":"2023-12-04T16:00:30","date_gmt":"2023-12-04T16:00:30","guid":{"rendered":"https:\/\/airoserver.com\/?p=34888"},"modified":"2023-12-04T07:30:22","modified_gmt":"2023-12-04T07:30:22","slug":"installing-and-configuring-apache-on-ubuntu","status":"publish","type":"post","link":"https:\/\/airoserver.com\/fa\/airoserver\/installing-and-configuring-apache-on-ubuntu\/","title":{"rendered":"Installing and configuring Apache on Ubuntu"},"content":{"rendered":"<h3><strong>Differences between Apache on Ubuntu and RedHat based distributions<\/strong><\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-34836 size-full\" src=\"https:\/\/airoserver.com\/wp-content\/uploads\/2023\/12\/Article-2.jpg\" alt=\"Apache\" width=\"1024\" height=\"550\" srcset=\"https:\/\/airoserver.com\/wp-content\/uploads\/2023\/12\/Article-2.jpg 1024w, https:\/\/airoserver.com\/wp-content\/uploads\/2023\/12\/Article-2-300x161.jpg 300w, https:\/\/airoserver.com\/wp-content\/uploads\/2023\/12\/Article-2-768x413.jpg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p>The reason why we need to specify which Linux distribution we are using to install Apache is that the process of installing and configuring this web server is different in each one. For example, in Ubuntu, the Apache web server is install through the apache2 package. While in Redhat-based distributions, we install this web server using the httpd package. Another difference is that the Apache configuration file is different in each distribution. For example, in Ubuntu, the settings are in <strong>\/etc\/apache2\/apache2.conf and \/etc\/apache2\/sites-available<\/strong>. If in Red Hat Base operating systems, the web server settings are in <strong>\/etc\/httpd\/conf\/httpd.conf.<\/strong><\/p>\n<h3><strong>How to install Apache on Ubuntu<\/strong><\/h3>\n<p>There are different ways to install it on Ubuntu. If you only want the original software, open a terminal and enter the following command.<\/p>\n<p><strong>sudo apt-get install apache2 \u2013y<\/strong><\/p>\n<p>After doing this command, It will\u00a0 install on the server. To ensure the availability of the Apache service, you can use the following command.<\/p>\n<p><strong>sudo systemctl enable apache2.<\/strong><\/p>\n<p>Apache can\u00a0 install in Red Hat Base operating systems using the following command.<\/p>\n<p><strong>apt install httpd<\/strong><\/p>\n<p>Enter the address http:\/\/SERVER_IP in your browser (instead of SERVER IP enter the IP address of your server).<\/p>\n<p>By viewing the Apache welcome page, you can confirm the correct installation of this web server on the server.<\/p>\n<h3><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-34835 size-full\" src=\"https:\/\/airoserver.com\/wp-content\/uploads\/2023\/12\/Article-3.jpg\" alt=\"Apache\" width=\"683\" height=\"900\" srcset=\"https:\/\/airoserver.com\/wp-content\/uploads\/2023\/12\/Article-3.jpg 683w, https:\/\/airoserver.com\/wp-content\/uploads\/2023\/12\/Article-3-228x300.jpg 228w\" sizes=\"auto, (max-width: 683px) 100vw, 683px\" \/><\/h3>\n<p>To access the page file that Apache is displaying, look at the \/var\/www\/html address.<\/p>\n<p>In this way, the settings of this page are done in the index.html file.<\/p>\n<h3><strong>How to build a site using Apache<\/strong><\/h3>\n<p>What we want to do now is to create a virtual host for it so that we can use this server to host multiple websites. Next, we will build a test host. In the first step, we create a directory for the Test host with the following command.<\/p>\n<p><strong>sudo mkdir -p \/var\/www\/html\/test<\/strong><\/p>\n<p>Then, with this command, we set the ownership of the directory.<\/p>\n<p><strong>sudo chown -R $USER:$USER \/var\/www\/html\/test<\/strong><\/p>\n<p>Finally, we apply the necessary access using the following command.<\/p>\n<p><strong>sudo chmod -R 755 \/var\/www\/html\/test<\/strong><\/p>\n<p>We transfer the new index.html file to the new host folder.<\/p>\n<p><strong>sudo cp \/var\/www\/html\/index.html \/var\/www\/html\/test<\/strong><\/p>\n<p>Now we need to include these settings in a file for Apache so that it knows where the files of these hosts are located. We create a file at \/etc\/apache\/sites-available.<\/p>\n<p><strong>sudo nano \/etc\/apache2\/sites-available\/test.conf<\/strong><\/p>\n<p>Enter the following settings in the file.<\/p>\n<p><strong>ServerAdmin admin@example.com<\/strong><\/p>\n<p><strong>ServerName example.com<\/strong><\/p>\n<p><strong>ServerAlias www.example.com<\/strong><\/p>\n<p><strong>DocumentRoot \/var\/www\/html\/test<\/strong><\/p>\n<p><strong>ErrorLog ${APACHE_LOG_DIR}\/error.log<\/strong><\/p>\n<p><strong>CustomLog ${APACHE_LOG_DIR}\/access.log combined<\/strong><\/p>\n<p>Finally, your host is created and you can host your website.<\/p>","protected":false},"excerpt":{"rendered":"<p>Differences between Apache on Ubuntu and RedHat based distributions The reason why we need to specify which Linux distribution we are using to install Apache is that the process of installing and configuring this web server is different in each one. For example, in Ubuntu, the Apache web server is install through the apache2 package. [&hellip;]<\/p>","protected":false},"author":26,"featured_media":34837,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[179,1],"tags":[],"class_list":["post-34888","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-airoserver","category-blog"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Installing and configuring Apache on Ubuntu - Airoserver | Cloud Hosting Solutions<\/title>\n<meta name=\"description\" content=\"We need to specify the Linux distribution we installed Apache the process of installing and configuring this web server varies in each one.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/airoserver.com\/fa\/airoserver\/installing-and-configuring-apache-on-ubuntu\/\" \/>\n<meta property=\"og:locale\" content=\"fa_IR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Installing and configuring Apache on Ubuntu - Airoserver | Cloud Hosting Solutions\" \/>\n<meta property=\"og:description\" content=\"We need to specify the Linux distribution we installed Apache the process of installing and configuring this web server varies in each one.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/airoserver.com\/fa\/airoserver\/installing-and-configuring-apache-on-ubuntu\/\" \/>\n<meta property=\"og:site_name\" content=\"Airoserver | Cloud Hosting Solutions\" \/>\n<meta property=\"article:published_time\" content=\"2023-12-04T16:00:30+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-04T07:30:22+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/airoserver.com\/wp-content\/uploads\/2023\/12\/Article-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"550\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Codinoob\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u0646\u0648\u0634\u062a\u0647\u200c\u0634\u062f\u0647 \u0628\u062f\u0633\u062a\" \/>\n\t<meta name=\"twitter:data1\" content=\"Codinoob\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u0632\u0645\u0627\u0646 \u062a\u0642\u0631\u06cc\u0628\u06cc \u0628\u0631\u0627\u06cc \u062e\u0648\u0627\u0646\u062f\u0646\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u062f\u0642\u06cc\u0642\u0647\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/airoserver.com\/airoserver\/installing-and-configuring-apache-on-ubuntu\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/airoserver.com\/airoserver\/installing-and-configuring-apache-on-ubuntu\/\"},\"author\":{\"name\":\"Codinoob\",\"@id\":\"https:\/\/airoserver.com\/#\/schema\/person\/98c9f3c9d2d2baaf929d2c4a53462e97\"},\"headline\":\"Installing and configuring Apache on Ubuntu\",\"datePublished\":\"2023-12-04T16:00:30+00:00\",\"dateModified\":\"2023-12-04T07:30:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/airoserver.com\/airoserver\/installing-and-configuring-apache-on-ubuntu\/\"},\"wordCount\":478,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/airoserver.com\/#organization\"},\"articleSection\":[\"AiroServer\",\"Blog\"],\"inLanguage\":\"fa-IR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/airoserver.com\/airoserver\/installing-and-configuring-apache-on-ubuntu\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/airoserver.com\/airoserver\/installing-and-configuring-apache-on-ubuntu\/\",\"url\":\"https:\/\/airoserver.com\/airoserver\/installing-and-configuring-apache-on-ubuntu\/\",\"name\":\"Installing and configuring Apache on Ubuntu - Airoserver | Cloud Hosting Solutions\",\"isPartOf\":{\"@id\":\"https:\/\/airoserver.com\/#website\"},\"datePublished\":\"2023-12-04T16:00:30+00:00\",\"dateModified\":\"2023-12-04T07:30:22+00:00\",\"description\":\"We need to specify the Linux distribution we installed Apache the process of installing and configuring this web server varies in each one.\",\"breadcrumb\":{\"@id\":\"https:\/\/airoserver.com\/airoserver\/installing-and-configuring-apache-on-ubuntu\/#breadcrumb\"},\"inLanguage\":\"fa-IR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/airoserver.com\/airoserver\/installing-and-configuring-apache-on-ubuntu\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/airoserver.com\/airoserver\/installing-and-configuring-apache-on-ubuntu\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/airoserver.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Installing and configuring Apache on Ubuntu\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/airoserver.com\/#website\",\"url\":\"https:\/\/airoserver.com\/\",\"name\":\"Airoserver | Cloud Hosting Solutions\",\"description\":\"Cloud server | Dedicated server | Domain | Hosting| SSL | Virtual server | Airoserver\",\"publisher\":{\"@id\":\"https:\/\/airoserver.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/airoserver.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"fa-IR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/airoserver.com\/#organization\",\"name\":\"Airoserver | Cloud Hosting Solutions\",\"url\":\"https:\/\/airoserver.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fa-IR\",\"@id\":\"https:\/\/airoserver.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/airoserver.com\/wp-content\/uploads\/2023\/09\/logo_airoserver.png\",\"contentUrl\":\"https:\/\/airoserver.com\/wp-content\/uploads\/2023\/09\/logo_airoserver.png\",\"width\":925,\"height\":880,\"caption\":\"Airoserver | Cloud Hosting Solutions\"},\"image\":{\"@id\":\"https:\/\/airoserver.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/airoserver.com\/#\/schema\/person\/98c9f3c9d2d2baaf929d2c4a53462e97\",\"name\":\"Codinoob\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fa-IR\",\"@id\":\"https:\/\/airoserver.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/016ea0daadd857a2718a67b0e8afc43ac449be1b2c2945db2414893811a00a97?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/016ea0daadd857a2718a67b0e8afc43ac449be1b2c2945db2414893811a00a97?s=96&d=mm&r=g\",\"caption\":\"Codinoob\"},\"sameAs\":[\"http:\/\/codinoob.ir\"],\"url\":\"https:\/\/airoserver.com\/fa\/author\/codinoob\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Installing and configuring Apache on Ubuntu - Airoserver | Cloud Hosting Solutions","description":"We need to specify the Linux distribution we installed Apache the process of installing and configuring this web server varies in each one.","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:\/\/airoserver.com\/fa\/airoserver\/installing-and-configuring-apache-on-ubuntu\/","og_locale":"fa_IR","og_type":"article","og_title":"Installing and configuring Apache on Ubuntu - Airoserver | Cloud Hosting Solutions","og_description":"We need to specify the Linux distribution we installed Apache the process of installing and configuring this web server varies in each one.","og_url":"https:\/\/airoserver.com\/fa\/airoserver\/installing-and-configuring-apache-on-ubuntu\/","og_site_name":"Airoserver | Cloud Hosting Solutions","article_published_time":"2023-12-04T16:00:30+00:00","article_modified_time":"2023-12-04T07:30:22+00:00","og_image":[{"width":1024,"height":550,"url":"https:\/\/airoserver.com\/wp-content\/uploads\/2023\/12\/Article-1.jpg","type":"image\/jpeg"}],"author":"Codinoob","twitter_card":"summary_large_image","twitter_misc":{"\u0646\u0648\u0634\u062a\u0647\u200c\u0634\u062f\u0647 \u0628\u062f\u0633\u062a":"Codinoob","\u0632\u0645\u0627\u0646 \u062a\u0642\u0631\u06cc\u0628\u06cc \u0628\u0631\u0627\u06cc \u062e\u0648\u0627\u0646\u062f\u0646":"3 \u062f\u0642\u06cc\u0642\u0647"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/airoserver.com\/airoserver\/installing-and-configuring-apache-on-ubuntu\/#article","isPartOf":{"@id":"https:\/\/airoserver.com\/airoserver\/installing-and-configuring-apache-on-ubuntu\/"},"author":{"name":"Codinoob","@id":"https:\/\/airoserver.com\/#\/schema\/person\/98c9f3c9d2d2baaf929d2c4a53462e97"},"headline":"Installing and configuring Apache on Ubuntu","datePublished":"2023-12-04T16:00:30+00:00","dateModified":"2023-12-04T07:30:22+00:00","mainEntityOfPage":{"@id":"https:\/\/airoserver.com\/airoserver\/installing-and-configuring-apache-on-ubuntu\/"},"wordCount":478,"commentCount":0,"publisher":{"@id":"https:\/\/airoserver.com\/#organization"},"articleSection":["AiroServer","Blog"],"inLanguage":"fa-IR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/airoserver.com\/airoserver\/installing-and-configuring-apache-on-ubuntu\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/airoserver.com\/airoserver\/installing-and-configuring-apache-on-ubuntu\/","url":"https:\/\/airoserver.com\/airoserver\/installing-and-configuring-apache-on-ubuntu\/","name":"Installing and configuring Apache on Ubuntu - Airoserver | Cloud Hosting Solutions","isPartOf":{"@id":"https:\/\/airoserver.com\/#website"},"datePublished":"2023-12-04T16:00:30+00:00","dateModified":"2023-12-04T07:30:22+00:00","description":"We need to specify the Linux distribution we installed Apache the process of installing and configuring this web server varies in each one.","breadcrumb":{"@id":"https:\/\/airoserver.com\/airoserver\/installing-and-configuring-apache-on-ubuntu\/#breadcrumb"},"inLanguage":"fa-IR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/airoserver.com\/airoserver\/installing-and-configuring-apache-on-ubuntu\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/airoserver.com\/airoserver\/installing-and-configuring-apache-on-ubuntu\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/airoserver.com\/"},{"@type":"ListItem","position":2,"name":"Installing and configuring Apache on Ubuntu"}]},{"@type":"WebSite","@id":"https:\/\/airoserver.com\/#website","url":"https:\/\/airoserver.com\/","name":"Airoserver | Cloud Hosting Solutions","description":"Cloud server | Dedicated server | Domain | Hosting| SSL | Virtual server | Airoserver","publisher":{"@id":"https:\/\/airoserver.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/airoserver.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"fa-IR"},{"@type":"Organization","@id":"https:\/\/airoserver.com\/#organization","name":"Airoserver | Cloud Hosting Solutions","url":"https:\/\/airoserver.com\/","logo":{"@type":"ImageObject","inLanguage":"fa-IR","@id":"https:\/\/airoserver.com\/#\/schema\/logo\/image\/","url":"https:\/\/airoserver.com\/wp-content\/uploads\/2023\/09\/logo_airoserver.png","contentUrl":"https:\/\/airoserver.com\/wp-content\/uploads\/2023\/09\/logo_airoserver.png","width":925,"height":880,"caption":"Airoserver | Cloud Hosting Solutions"},"image":{"@id":"https:\/\/airoserver.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/airoserver.com\/#\/schema\/person\/98c9f3c9d2d2baaf929d2c4a53462e97","name":"Codinoob","image":{"@type":"ImageObject","inLanguage":"fa-IR","@id":"https:\/\/airoserver.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/016ea0daadd857a2718a67b0e8afc43ac449be1b2c2945db2414893811a00a97?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/016ea0daadd857a2718a67b0e8afc43ac449be1b2c2945db2414893811a00a97?s=96&d=mm&r=g","caption":"Codinoob"},"sameAs":["http:\/\/codinoob.ir"],"url":"https:\/\/airoserver.com\/fa\/author\/codinoob\/"}]}},"_links":{"self":[{"href":"https:\/\/airoserver.com\/fa\/wp-json\/wp\/v2\/posts\/34888","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/airoserver.com\/fa\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/airoserver.com\/fa\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/airoserver.com\/fa\/wp-json\/wp\/v2\/users\/26"}],"replies":[{"embeddable":true,"href":"https:\/\/airoserver.com\/fa\/wp-json\/wp\/v2\/comments?post=34888"}],"version-history":[{"count":0,"href":"https:\/\/airoserver.com\/fa\/wp-json\/wp\/v2\/posts\/34888\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/airoserver.com\/fa\/wp-json\/wp\/v2\/media\/34837"}],"wp:attachment":[{"href":"https:\/\/airoserver.com\/fa\/wp-json\/wp\/v2\/media?parent=34888"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/airoserver.com\/fa\/wp-json\/wp\/v2\/categories?post=34888"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/airoserver.com\/fa\/wp-json\/wp\/v2\/tags?post=34888"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}