{"id":1051,"date":"2020-04-22T07:27:01","date_gmt":"2020-04-22T07:27:01","guid":{"rendered":"https:\/\/hostry.com\/blog\/?p=1051"},"modified":"2020-04-22T07:27:03","modified_gmt":"2020-04-22T07:27:03","slug":"apache-reliable-http-server","status":"publish","type":"post","link":"https:\/\/hostry.com\/blog\/apache-reliable-http-server\/","title":{"rendered":"Apache &#8211; reliable and flexible HTTP web server"},"content":{"rendered":"\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"926\" height=\"382\" src=\"https:\/\/hostry.com\/blog\/wp-content\/uploads\/2019\/10\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2019-10-28-08-49-37-1.jpeg\" alt=\"\" class=\"wp-image-1087\" srcset=\"https:\/\/hostry.com\/blog\/wp-content\/uploads\/2019\/10\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2019-10-28-08-49-37-1.jpeg 926w, https:\/\/hostry.com\/blog\/wp-content\/uploads\/2019\/10\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2019-10-28-08-49-37-1-450x186.jpeg 450w, https:\/\/hostry.com\/blog\/wp-content\/uploads\/2019\/10\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2019-10-28-08-49-37-1-300x124.jpeg 300w, https:\/\/hostry.com\/blog\/wp-content\/uploads\/2019\/10\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2019-10-28-08-49-37-1-768x317.jpeg 768w\" sizes=\"auto, (max-width: 926px) 100vw, 926px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">To begin with, by clarifying what the Web Server is. Web <strong><em><a href=\"https:\/\/hostry.com\/products\/vps\/\">server<\/a><\/em><\/strong> &#8211; a program running on a local or remote machine. Its main purpose is to allow the user to view web documents. When the site address is entered in the address bar, press Enter, the browser generates a request. It is sent to a remote computer &#8211; a web server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><a href=\"https:\/\/en.wikipedia.org\/wiki\/Apache_HTTP_Server\" target=\"_blank\" rel=\"noopener\">This web server<\/a><\/strong> dates back to 1995. It is believed that it comes from &#8220;a patchy&#8221;. It was designed to correct errors and adjust the operation of the then popular HTTPd 1.3 server. This flexible web server is maintained and developed by an open community of developers under the symbolic name &#8220;Apache Software Foundation&#8221;. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Since April 1995, it has already been considered the most reliable and popular HTTP server in the entire Internet space. It is also interesting that in 2016 it was serviced by more than 305 million sites. View current versions, download links for this web server. As well as more information about this very flexible and reliable server can be found <strong><em><a href=\"https:\/\/httpd.apache.org\/\" target=\"_blank\" rel=\"noopener\">here<\/a><\/em><\/strong>. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this day, this web server serves the work of sites and provides a load of about 46% of all sites in the world. This server provides quality service for content on the sites of all users. When someone wants to visit the site, he writes the domain name in the address bar of his browser. The web server then delivers the requested files as a virtual messenger. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When any visitor to your site wants to download a page (for example, the &#8220;about us&#8221; page on hostry.com). Its browser sends a request to your server. Then Apache returns a response with absolutely all the requested files from this site. It can be pictures, text animation. The server and client communicate via HTTP. This server is responsible for the operation, flexibility, secure connection and reliability between two computers.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Advantages and disadvantages of choosing this server<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This web server has its advantages and also some disadvantages compared to other web servers. We would like to describe them below for your reference:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Advantages <\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>This reliable server is absolutely free for commercial use. If you have plans to build a small budget project, then this web server is ideal for you! <\/strong><\/li><li><strong>It is very flexible and has stable software; <\/strong><\/li><li><strong>Apache HTTP web server is updated very often, security patches come out regularly; <\/strong><\/li><li><strong>Works for sites on the WordPress platform immediately after installation, and there is no need to configure additional settings.<\/strong><\/li><li><strong>Very easy to set up<\/strong><\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Disadvantages<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>If you have entered too many configuration parameters for this web server, then this may lead to small security vulnerabilities; <\/strong><\/li><li><strong>There may also be some performance issues on sites with high enough traffic.<\/strong><\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Apache HTTP web server also has the advantages that it works great and is compatible with many other systems, such as Joomla, Drupal and other content management systems. This makes this web server a very confident solution for you in working with these systems. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Linux Apache Web Server Configuration<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">We\u2019ll provide a short guide below on how to configure this flexible and highly reliable web server. Apache configuration for all virtual hosts is determined using a single file &#8211; <strong>\/etc\/httpd\/conf\/httpd.conf<\/strong> (this is the case when it comes to configuration on OSs such as<em> CentOS, CloudLinux, Red Hat Enterprise Linux<\/em>). Or the file<strong> \/etc\/apache2\/apache2.conf<\/strong>, which is applicable on<em> Debian <\/em>and <em>Ubuntu<\/em> respectively. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Virtual server configuration files are at the lowest level of the configuration file hierarchy. They get into the Apache configuration file (<strong><em>last_httpd.conf<\/em><\/strong>) through several levels of inclusion using the include directive. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Nginx uses a similar approach: the \/etc\/nginx\/nginx.conf file contains configuration files. They are available in all virtual servers with several levels of inclusion. It is very important to know about the hierarchy of Apache configuration servers. For more information, we offer you the <strong><em><a href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-configure-the-apache-web-server-on-an-ubuntu-or-debian-vps\" target=\"_blank\" rel=\"noopener\">following link<\/a><\/em><\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Each virtual server should have two files &#8211; last_httpd.conf and <strong>last_nginx.conf<\/strong>. They define the standard configuration of Apache and nginx for the corresponding virtual server. These files are always located in the<strong> \/var\/www\/vhosts \/ system\/&lt;domain name&gt;\/ conf\/ <\/strong>folder. Then created automatically based on the so-called configuration templates.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Working with the Apache HTTP web server<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">After you have installed this web server (<strong>apt install apache<\/strong>) and indicated the need to automatically start the httpd service when the system starts, you can additionally test it. You need to enter <strong>&#8220;http:\/\/server ip-address\/&#8221; <\/strong>in absolutely any browser. It is advisable to manage your running web server with the following directives:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">service httpd status<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The following directive will show you a list of running web server processes. Inform you that the web server has not been loaded:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">service httpd stop; service httpd start<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The following directive stops and then immediately starts the main web server process:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">service httpd restart<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Configure firewall to allow traffic<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Based on the fact that this server has already been started, the following is necessary to enable the UFW firewall. The first thing to do is make sure that UFW has a profile for Apache:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo ufw app list<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Next will be the following conclusion:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Available applications:\n&nbsp;&nbsp;Apache\n&nbsp;&nbsp;Apache full\n&nbsp;&nbsp;Apache secure\n&nbsp;&nbsp;Openssh<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">After that, you need to check the configuration of the Apache Full profile (traffic should be allowed for ports 80 and 443):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo ufw app info \"Apache Full\"<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The following output will be shown:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Profile: Apache Full\nTitle: Web Server (HTTP, HTTPS)\nDescription: Apache v2 is the next generation of the omnipresent Apache web\nserver.\n\nPorts:\n&nbsp;&nbsp;80,443 \/ tcp<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Next, we allow incoming HTTP and HTTPS traffic for this profile:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo ufw allow in \"Apache Full\"<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">We check the result by entering the following into the search browser browser:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">http:\/\/your_server_IP_address<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Optimization of the Apache web server <\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This flexible and realible web server is very productive. It offers a fairly large number of modules. It is great for deploying new projects &#8211; you can set up a reliable manufacturing environment with it. As your project grows, there may be problems, and the first thing that will be described is disabling unnecessary modules.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Disabling unnecessary modules<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">On operating systems such as Debian and Ubuntu- there are directories <strong>\/etc\/apache2\/mods-enabled<\/strong> and<strong> \/etc\/apache2\/mods-available\/<\/strong>. The latter contains a list of all modules installed on this server. And in the mods-enabled directory are the modules that are currently enabled.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The first is to save the list of modules that are active by default so that you can later use it to restore default settings. After that, you can simply disable all unnecessary modules one at a time, restarting Apache after disabling each module to make sure that no errors have occurred in the system. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In Ubuntu and Debian, these modules can be disabled using the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo a2dismod autoindex<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">We also want to note: for example, one child process in the Apache HTTP web server can take up to 80-100 MB of RAM. If you plan to launch a large project, which is likely to grow later, we recommend tariffs with availability of 4GB RAM or more! This will help you maintain balance in <strong><em><a href=\"https:\/\/hostry.com\/products\/vps\/\">server<\/a><\/em><\/strong> load!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Alternative mpm configurations<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Very often, Apache realible configurations use the prefork mpm configuration. It is considered safe and suitable for PHP and other languages. However: if you get rid of external modules, you can also consider worker <strong>MPM<\/strong> as a good alternative. To enable this module, enter the following:<\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-1 wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"400\" height=\"317\" src=\"https:\/\/hostry.com\/blog\/wp-content\/uploads\/2019\/10\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2019-10-28-15-05-00.png\" alt=\"\" data-id=\"1108\" data-link=\"https:\/\/hostry.com\/blog\/?attachment_id=1108\" class=\"wp-image-1108\" srcset=\"https:\/\/hostry.com\/blog\/wp-content\/uploads\/2019\/10\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2019-10-28-15-05-00.png 400w, https:\/\/hostry.com\/blog\/wp-content\/uploads\/2019\/10\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2019-10-28-15-05-00-300x238.png 300w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>To begin with, by clarifying what the Web Server is. Web server &#8211; a program running on a local or remote machine. Its main purpose is to allow t&#8230;<\/p>\n","protected":false},"author":6,"featured_media":1221,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[50,56,36,55,57],"class_list":["post-1051","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web-servers","tag-apache","tag-flexible","tag-https","tag-reliable","tag-server"],"read_time":5,"_links":{"self":[{"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/posts\/1051","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/comments?post=1051"}],"version-history":[{"count":53,"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/posts\/1051\/revisions"}],"predecessor-version":[{"id":1219,"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/posts\/1051\/revisions\/1219"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/media\/1221"}],"wp:attachment":[{"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/media?parent=1051"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/categories?post=1051"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/tags?post=1051"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}