{"id":13802,"date":"2019-04-06T09:13:52","date_gmt":"2019-04-06T09:13:52","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=13802"},"modified":"2019-04-06T09:13:52","modified_gmt":"2019-04-06T09:13:52","slug":"3-ways-to-check-apache-server-status-and-uptime-in-linux","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/04\/06\/3-ways-to-check-apache-server-status-and-uptime-in-linux\/","title":{"rendered":"3 Ways to Check Apache Server Status and Uptime in Linux"},"content":{"rendered":"<p><strong>Apache<\/strong>\u00a0is a world\u2019s most popular, cross platform HTTP web server that is commonly used in Linux and Unix platforms to deploy and run web applications or websites. Importantly, it\u2019s easy to install and has a simple configuration as well.<\/p>\n<p><strong>Read Also<\/strong>:\u00a0<a href=\"https:\/\/www.tecmint.com\/hide-apache-web-server-version-information\/\" target=\"_blank\" rel=\"noopener\">How to Hide Apache Version Number and Other Sensitive Info<\/a><\/p>\n<p>In this article, we will show how to check Apache web server uptime on a Linux system using different methods\/commands explained below.<\/p>\n<h3>1. Systemctl Utility<\/h3>\n<p><strong>Systemctl<\/strong>\u00a0is a utility for controlling the systemd system and service manager; it is used it to start, restart, stop services and beyond. The systemctl status sub-command, as the name states is used to view the status of a service, you can use it for the above purpose like so:<\/p>\n<pre>$ sudo systemctl status apache2\t  #Debian\/Ubuntu \r\n# systemctl status httpd\t  #RHEL\/CentOS\/Fedora \r\n<\/pre>\n<div id=\"attachment_26986\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/09\/Check-Apache-Status-Using-Systemctl.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-26986\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/09\/Check-Apache-Status-Using-Systemctl.png\" sizes=\"auto, (max-width: 772px) 100vw, 772px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/09\/Check-Apache-Status-Using-Systemctl.png 772w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/09\/Check-Apache-Status-Using-Systemctl-768x531.png 768w\" alt=\"Check Apache Status Using Systemctl\" width=\"772\" height=\"534\" aria-describedby=\"caption-attachment-26986\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-26986\" class=\"wp-caption-text\">Check Apache Status Using Systemctl<\/p>\n<\/div>\n<h3>2. Apachectl Utilities<\/h3>\n<p><strong>Apachectl<\/strong>\u00a0is a control interface for Apache HTTP server. This method requires the\u00a0<strong>mod_status<\/strong>\u00a0(which displays info about the server is performing including its uptime) module installed and enabled (which is the default setting).<\/p>\n<h4>On Debian\/Ubuntu<\/h4>\n<p>The\u00a0<strong>server-status<\/strong>\u00a0component is enabled by default using the file\u00a0<strong>\/etc\/apache2\/mods-enabled\/status.conf<\/strong>.<\/p>\n<pre>$ sudo vi \/etc\/apache2\/mods-enabled\/status.conf\r\n<\/pre>\n<div id=\"attachment_26987\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/09\/Apache-Mod_Status-Configuration.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-26987\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/09\/Apache-Mod_Status-Configuration.png\" sizes=\"auto, (max-width: 862px) 100vw, 862px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/09\/Apache-Mod_Status-Configuration.png 862w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/09\/Apache-Mod_Status-Configuration-768x543.png 768w\" alt=\"Apache Mod_Status Configuration\" width=\"862\" height=\"610\" aria-describedby=\"caption-attachment-26987\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-26987\" class=\"wp-caption-text\">Apache Mod_Status Configuration<\/p>\n<\/div>\n<h4>On RHEL\/CentOS<\/h4>\n<p>To enable\u00a0<strong>server-status<\/strong>\u00a0component, create a file below.<\/p>\n<pre># vi \/etc\/httpd\/conf.d\/server-status.conf\r\n<\/pre>\n<p>and add the following configuration.<\/p>\n<pre>&lt;Location \"\/server-status\"&gt;\r\n    SetHandler server-status\r\n    #Require  host  localhost\t\t#uncomment to only allow requests from localhost \r\n&lt;\/Location&gt;\r\n<\/pre>\n<p>Save the file and close it. Then restart the web server.<\/p>\n<pre># systemctl restart httpd\r\n<\/pre>\n<p>If you are primarily using a terminal, then you also need a\u00a0<a href=\"https:\/\/www.tecmint.com\/command-line-web-browsers\/\" target=\"_blank\" rel=\"noopener\">command line web browser such as lynx or links<\/a>.<\/p>\n<pre>$ sudo apt install lynx\t\t#Debian\/Ubuntu\r\n# yum install links\t\t#RHEL\/CentOS\r\n<\/pre>\n<p>Then run the command below to check the Apache service uptime:<\/p>\n<pre>$ apachectl status\r\n<\/pre>\n<div id=\"attachment_26988\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/09\/Check-Apache-Status-Using-Apache2ctl.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-26988\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/09\/Check-Apache-Status-Using-Apache2ctl.png\" sizes=\"auto, (max-width: 772px) 100vw, 772px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/09\/Check-Apache-Status-Using-Apache2ctl.png 772w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/09\/Check-Apache-Status-Using-Apache2ctl-768x550.png 768w\" alt=\"Check Apache Status Using Apache2ctl\" width=\"772\" height=\"553\" aria-describedby=\"caption-attachment-26988\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-26988\" class=\"wp-caption-text\">Check Apache Status Using Apache2ctl<\/p>\n<\/div>\n<p>Alternatively, use the URL below to view the Apache web server status information from a graphical web browser:<\/p>\n<pre>http:\/\/localhost\/server-status\r\nOR\r\nhttp:SERVER_IP\/server-status\r\n<\/pre>\n<h3>3. ps Utility<\/h3>\n<p><strong>ps<\/strong>\u00a0is a utility which shows information concerning a selection of the active processes running on a Linux system, you can use it with\u00a0<a href=\"https:\/\/www.tecmint.com\/12-practical-examples-of-linux-grep-command\/\" target=\"_blank\" rel=\"noopener\">grep command<\/a>\u00a0to check Apache service uptime as follows.<\/p>\n<p>Here, the flag:<\/p>\n<ul>\n<li><code>-e<\/code>\u00a0\u2013 enables selection of every processes on the system.<\/li>\n<li><code>-o<\/code>\u00a0\u2013 is used to specify output (comm \u2013 command, etime \u2013 process execution time and user \u2013 process owner).<\/li>\n<\/ul>\n<pre># ps -eo comm,etime,user | grep apache2\r\n# ps -eo comm,etime,user | grep root | grep apache2\r\nOR\r\n# ps -eo comm,etime,user | grep httpd\r\n# ps -eo comm,etime,user | grep root | grep httpd\r\n<\/pre>\n<p>The sample output below shows that\u00a0<strong>apache2<\/strong>\u00a0service has been running for 4 hours, 10 minutes and 28 seconds (only consider the one started by root).<\/p>\n<div id=\"attachment_26989\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/09\/Check-Apache-Uptime.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-26989\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/09\/Check-Apache-Uptime.png\" sizes=\"auto, (max-width: 772px) 100vw, 772px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/09\/Check-Apache-Uptime.png 772w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2017\/09\/Check-Apache-Uptime-768x229.png 768w\" alt=\"Check Apache Uptime\" width=\"772\" height=\"230\" aria-describedby=\"caption-attachment-26989\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-26989\" class=\"wp-caption-text\">Check Apache Uptime<\/p>\n<\/div>\n<p>Lastly, check out more useful Apache web server guides:<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\n<li><a href=\"https:\/\/www.tecmint.com\/apache-security-tips\/\" target=\"_blank\" rel=\"noopener\">13 Apache Web Server Security and Hardening Tips<\/a><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/check-apache-modules-enabled\/\" target=\"_blank\" rel=\"noopener\">How to Check Which Apache Modules are Enabled\/Loaded in Linux<\/a><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/apache-performance-tuning\/\" target=\"_blank\" rel=\"noopener\">5 Tips to Boost the Performance of Your Apache Web Server<\/a><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/password-protect-apache-web-directories-using-htaccess\/\" target=\"_blank\" rel=\"noopener\">How to Password Protect Web Directories in Apache Using .htaccess File<\/a><\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p>In this article, we showed you three different ways to check Apache\/HTTPD service uptime on a Linux system. If you have any questions or thoughts to share, do that via the comment section below.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/check-apache-httpd-status-and-uptime-in-linux\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Apache\u00a0is a world\u2019s most popular, cross platform HTTP web server that is commonly used in Linux and Unix platforms to deploy and run web applications or websites. Importantly, it\u2019s easy to install and has a simple configuration as well. Read Also:\u00a0How to Hide Apache Version Number and Other Sensitive Info In this article, we will &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/04\/06\/3-ways-to-check-apache-server-status-and-uptime-in-linux\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;3 Ways to Check Apache Server Status and Uptime in Linux&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-13802","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13802","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=13802"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13802\/revisions"}],"predecessor-version":[{"id":13803,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13802\/revisions\/13803"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=13802"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=13802"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=13802"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}