{"id":16127,"date":"2023-06-22T09:10:28","date_gmt":"2023-06-22T09:10:28","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=16127"},"modified":"2023-09-18T16:03:53","modified_gmt":"2023-09-18T16:03:53","slug":"how-to-enable-mod_status-apache-module-on-ubuntu-centos","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-enable-mod_status-apache-module-on-ubuntu-centos\/","title":{"rendered":"How to Enable mod_status Apache module on Ubuntu\/CentOS"},"content":{"rendered":"<p><img decoding=\"async\" data-src=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/06\/How-to-Enable-mod_status-Apache-module-on-Ubuntu_CentOS-1024x768.jpg\" alt=\"How to Enable mod_status Apache module on Ubuntu_CentOS\" width=\"1024\" height=\"768\" class=\"alignnone size-large wp-image-16128 lazyload\" data-srcset=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/06\/How-to-Enable-mod_status-Apache-module-on-Ubuntu_CentOS-1024x768.jpg 1024w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/06\/How-to-Enable-mod_status-Apache-module-on-Ubuntu_CentOS-300x225.jpg 300w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/06\/How-to-Enable-mod_status-Apache-module-on-Ubuntu_CentOS-1536x1152.jpg 1536w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/06\/How-to-Enable-mod_status-Apache-module-on-Ubuntu_CentOS-2048x1536.jpg 2048w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/06\/How-to-Enable-mod_status-Apache-module-on-Ubuntu_CentOS-128x96.jpg 128w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/06\/How-to-Enable-mod_status-Apache-module-on-Ubuntu_CentOS-420x315.jpg 420w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/06\/How-to-Enable-mod_status-Apache-module-on-Ubuntu_CentOS-540x405.jpg 540w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/06\/How-to-Enable-mod_status-Apache-module-on-Ubuntu_CentOS-720x540.jpg 720w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/06\/How-to-Enable-mod_status-Apache-module-on-Ubuntu_CentOS-960x720.jpg 960w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/06\/How-to-Enable-mod_status-Apache-module-on-Ubuntu_CentOS-1140x855.jpg 1140w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/06\/How-to-Enable-mod_status-Apache-module-on-Ubuntu_CentOS-1320x990.jpg 1320w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/06\/How-to-Enable-mod_status-Apache-module-on-Ubuntu_CentOS-1440x1080.jpg 1440w\" data-sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/768;\" \/><\/p>\n<p>Apache stands as one of the most widely used and versatile options available in the world of web servers. It offers a range of modules that enhance its functionality, one of which is the mod_status module. This module provides valuable insights into server activity and performance, making it an essential tool for server administrators.<\/p>\n<p>In this tutorial, we will guide you on how to enable the mod_status Apache module on <a href=\"https:\/\/webhostinggeeks.com\/blog\/what-is-ubuntu-beginners-guide-ubuntu-linux-distro\/\">Ubuntu<\/a> and <a href=\"https:\/\/webhostinggeeks.com\/blog\/what-is-centos-beginners-guide-centos-linux-distro\/\">CentOS<\/a> systems.<\/p>\n<p>Before we dive into the tutorial, it&#8217;s worth noting that there are several types of web servers available, each with its unique features and benefits. For a comprehensive comparison and to find the <a href='https:\/\/webhostinggeeks.com\/best\/web-server\/'>best web servers<\/a> for your needs, you can check our detailed guide.<\/p>\n<h2>Understanding Apache mod_status Module<\/h2>\n<p>The Apache mod_status module provides a server administrator with insights into how well their server is performing. It presents a HTML page with current server statistics in an easily readable form.<\/p>\n<p><img decoding=\"async\" data-src=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/06\/Apache-Status-module-\u2013-mod_status-1024x855.png\" alt=\"Apache Status module \u2013 mod_status\" width=\"1024\" height=\"855\" class=\"alignnone size-large wp-image-16131 border lazyload\" data-srcset=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/06\/Apache-Status-module-\u2013-mod_status-1024x855.png 1024w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/06\/Apache-Status-module-\u2013-mod_status-300x251.png 300w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/06\/Apache-Status-module-\u2013-mod_status-128x107.png 128w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/06\/Apache-Status-module-\u2013-mod_status-420x351.png 420w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/06\/Apache-Status-module-\u2013-mod_status-540x451.png 540w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/06\/Apache-Status-module-\u2013-mod_status-720x601.png 720w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/06\/Apache-Status-module-\u2013-mod_status-960x802.png 960w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/06\/Apache-Status-module-\u2013-mod_status-862x720.png 862w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2023\/06\/Apache-Status-module-\u2013-mod_status.png 1056w\" data-sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/855;\" \/><\/p>\n<p>The details provided include the number of workers serving requests, the number of idle workers, the status of each worker, the number of requests that worker has performed, the total number of bytes served by the worker, and more.<\/p>\n<p>For more detailed information on the Apache server, you can refer to our in-depth article on <a href='https:\/\/webhostinggeeks.com\/blog\/apache-http-server-explained\/'>Apache HTTP Server<\/a>.<\/p>\n<h2>Enabling mod_status Apache Module on Ubuntu\/CentOS<\/h2>\n<p>To enable the mod_status module on your Apache server, you need to follow these steps:<\/p>\n<h3>Step 1: Check if mod_status is enabled<\/h3>\n<p>First, you need to check if the mod_status module is already enabled on your Apache server. You can do this by running the following command:<\/p>\n<pre>\r\napachectl -M | grep status\r\n<\/pre>\n<p>If the module is enabled, you will see &#8216;status_module (shared)&#8217; in the output. If not, you need to enable it.<\/p>\n<pre>\r\ndimitri@geekapi:~# apachectl -M | grep status\r\nstatus_module (shared)\r\ndimitri@geekapi:~#   \r\n<\/pre>\n<h3>Step 2: Enable mod_status<\/h3>\n<p>On Ubuntu, you can enable the mod_status module by running the following command:<\/p>\n<pre>\r\nsudo a2enmod status\r\n<\/pre>\n<p>On CentOS, the mod_status module is usually enabled by default. If it&#8217;s not, you can enable it by uncommenting the &#8216;LoadModule status_module modules\/mod_status.so&#8217; line in the httpd.conf file.<\/p>\n<p>Here&#8217;s how you can enable the mod_status module on CentOS by uncommenting the appropriate line in the httpd.conf file:<\/p>\n<p>First, you need to open the httpd.conf file. This file is usually located in the \/etc\/httpd\/ directory. You can open it using a text editor like vi or nano. Here&#8217;s how to do it with vi:<\/p>\n<pre>\r\nsudo vi \/etc\/httpd\/conf\/httpd.conf\r\n<\/pre>\n<p>Next, you need to search for the line that loads the mod_status module. In vi, you can do this by pressing &#8216;\/&#8217; and then typing the part of the line you&#8217;re looking for, like so:<\/p>\n<pre>\r\n\/LoadModule status_module\r\n<\/pre>\n<p>This should highlight the line &#8216;LoadModule status_module modules\/mod_status.so&#8217;.<\/p>\n<p>If the line is commented out (i.e., if it starts with a &#8216;#&#8217;), you need to uncomment it. In vi, you can do this by moving the cursor to the &#8216;#&#8217; character and then pressing &#8216;x&#8217;. This will delete the &#8216;#&#8217; character and uncomment the line.<\/p>\n<p>After uncommenting the line, you need to save the changes and exit the text editor. In vi, you can do this by pressing &#8216;:&#8217;, then typing &#8216;wq&#8217;, and finally pressing &#8216;Enter&#8217;. This will write the changes to the file (w) and quit the text editor (q).<\/p>\n<pre>\r\n:wq\r\n<\/pre>\n<p>Finally, you need to restart your Apache server for the changes to take effect. You can do this by running the following command:<\/p>\n<pre>\r\nsudo systemctl restart httpd\r\n<\/pre>\n<p>Now, the mod_status module should be enabled on your CentOS Apache server.<\/p>\n<h3>Step 3: Configure mod_status<\/h3>\n<p>To configure mod_status, you need to add a specific code block to your Apache configuration file. This block will allow status reports only for browsers from a specific domain. Here is an example:<\/p>\n<pre>\r\n&lt;Location \"\/server-status\"&gt;\r\n SetHandler server-status\r\n Require host example.com\r\n&lt;\/Location&gt;\r\n<\/pre>\n<p>Replace &#8216;example.com&#8217; with your domain. After adding this block, you can access server statistics by using a web browser to access the page http:\/\/your.server.name\/server-status.<\/p>\n<h3>Step 4: Restart Apache<\/h3>\n<p>After enabling and configuring the mod_status module, you need to restart your Apache server for the changes to take effect. You can do this by running the following command:<\/p>\n<p>On Ubuntu:<\/p>\n<pre>\r\nsudo systemctl restart apache2\r\n<\/pre>\n<p>On CentOS:<\/p>\n<pre>\r\nsudo systemctl restart httpd\r\n<\/pre>\n<p>Now, you should be able to access the server status page at http:\/\/your.server.name\/server-status.<\/p>\n<h2>Using mod_status for Troubleshooting<\/h2>\n<p>The server-status page can be used as a starting point for troubleshooting situations where your server is consuming all available resources (CPU or memory), and you wish to identify which requests or clients are causing the problem.<\/p>\n<p>First, ensure that you have ExtendedStatus set on, so that you can see the full request and client information for each child or thread. Now look in your process list (using top, or similar process viewing utility) to identify the specific processes that are the main culprits. Order the output of top by CPU usage, or memory usage, depending on what problem you&#8217;re trying to address.<\/p>\n<p>Reload the server-status page, and look for those process ids, and you&#8217;ll be able to see what request is being served by that process, for what client. Requests are transient, so you may need to try several times before you catch it in the act, so to speak.<\/p>\n<p>This process should give you some idea of what client, or what type of requests, are primarily responsible for your load problems. Often you will identify a particular web application that is misbehaving, or a particular client that is attacking your site.<\/p>\n<h2>Commands Mentioned<\/h2>\n<ul>\n<li><span class=\"fw-bold\">apachectl -M | grep status<\/span> \u2013 Checks if mod_status is enabled on your Apache server<\/li>\n<li><span class=\"fw-bold\">sudo a2enmod status<\/span> \u2013 Enables mod_status on Ubuntu<\/li>\n<li><span class=\"fw-bold\">sudo systemctl restart apache2<\/span> \u2013 Restarts Apache server on Ubuntu<\/li>\n<li><span class=\"fw-bold\">sudo systemctl restart httpd<\/span> \u2013 Restarts Apache server on CentOS<\/li>\n<\/ul>\n<h2>FAQ<\/h2>\n<ol itemscope itemtype=\"https:\/\/schema.org\/FAQPage\">\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">What is the Apache mod_status module?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">The Apache mod_status module is a tool that provides server administrators with insights into server activity and performance. It presents a HTML page with current server statistics in an easily readable form.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">How can I enable the mod_status module on Ubuntu?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">On Ubuntu, you can enable the mod_status module by running the &#8216;sudo a2enmod status&#8217; command in the terminal. After enabling the module, you need to restart your Apache server for the changes to take effect.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">How can I enable the mod_status module on CentOS?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">On CentOS, the mod_status module is usually enabled by default. If it&#8217;s not, you can enable it by uncommenting the &#8216;LoadModule status_module modules\/mod_status.so&#8217; line in the httpd.conf file. After enabling the module, you need to restart your Apache server for the changes to take effect.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">How can I access the server status page?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">After enabling and configuring the mod_status module, you can access the server status page by using a web browser to visit the page http:\/\/your.server.name\/server-status. Replace &#8216;your.server.name&#8217; with your actual server name.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">How can I use mod_status for troubleshooting?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">The server-status page can be used as a starting point for troubleshooting situations where your server is consuming all available resources (CPU or memory), and you wish to identify which requests or clients are causing the problem. Ensure that you have ExtendedStatus set on, so that you can see the full request and client information for each child or thread. Then, use a process viewing utility to identify the specific processes that are the main culprits. Reload the server-status page, and look for those process ids to see what request is being served by that process, for what client.<\/span>\n            <\/p>\n<\/li>\n<\/ol>\n<h2>Conclusion<\/h2>\n<p>The Apache mod_status module is a powerful tool that provides valuable insights into server activity and performance. By enabling this module, server administrators can monitor their server&#8217;s performance in real-time and troubleshoot issues more effectively. This tutorial provided a step-by-step guide on how to enable the mod_status module on Ubuntu and CentOS systems.<\/p>\n<p>Remember, Apache is just one of the many web servers available. Depending on your specific needs, you might find that other servers like <a href='https:\/\/webhostinggeeks.com\/blog\/nginx-server-explained\/'>Nginx<\/a> or <a href='https:\/\/webhostinggeeks.com\/blog\/litespeed-web-server-explained\/'>LiteSpeed<\/a> are more suitable. Additionally, the type of hosting you choose, whether it&#8217;s <a href='https:\/\/webhostinggeeks.com\/blog\/what-is-dedicated-server-hosting\/'>dedicated server<\/a>, <a href='https:\/\/webhostinggeeks.com\/blog\/what-is-vps-hosting\/'>VPS server<\/a>, <a href='https:\/\/webhostinggeeks.com\/blog\/what-is-cloud-hosting\/'>cloud hosting<\/a>, or <a href='https:\/\/webhostinggeeks.com\/blog\/what-is-shared-hosting\/'>shared hosting<\/a>, can also impact your server&#8217;s performance.<\/p>\n<p>We hope this guide has been helpful. If you have any further questions, feel free to ask.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Apache stands as one of the most widely used and versatile options available in the world of web servers. It offers a range of modules that enhance its functionality, one&#8230;<\/p>\n","protected":false},"author":6,"featured_media":16128,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[1103,2055,1073],"tags":[1199,2079,2080],"class_list":["post-16127","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-apache","category-centos","category-ubuntu","tag-apache","tag-apache-module","tag-mod_status"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/16127","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=16127"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/16127\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/16128"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=16127"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=16127"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=16127"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}