ManagedCloud Servers

High performance handled and monitored by us 24/7/365. A complete solution to provide you with our in house expertise 24/7 tailored to your specific needs. We'll setup a bespoke server for your site using the latest tehnologies so you can get the most out of your hardware and get your website loading quickly and reliably. Find out more..

cPanelCloud Servers

Recommended - High performance cloud servers with no technical knowledge required. If you're hosting multiple websites already and you're looking to consolidate, or if you're looking to isolate yourself from the shared hosting environment but you don't have the time or knoweldge to manage a server, then the Managed cPanel Servers are for you. Find out more..

UnmanagedCloud Servers

Our unmanaged range gives you complete control at rock bottom prices and our cloud platform boasts super fast multipath 40Gb/s network, the latest Intel Xeon V3 CPUs and enterprise grade redundant SSDs. If you're a sysadmin look no further, we offer some of the best specification to price ratio servers available. Find out more..

Need Web Hosting? Try ours, it's fast, reliable and feature loaded with support you can depend on. From £1.60 / month.

View Plans

Monitor Apache Server Load and Page Statistics Using Mod_Status

Apache is the most popular and widely used web server in the world, so it is important to monitor and debug the performance. Mod_status is an Apache module that is used to monitor Apache web server load and current connections via a web based interface. Mod_status allows a system administrator to monitor performance of Apache server. Mod_status is the most useful and easiest module to confgure with Apache.

The Mod_status module shows the following information:

  • Server load and uptime.
  • CPU usage and total traffic of Web Server.
  • Total number of incoming connections.
  • Total number of bytes and counts server.
  • Total number of idle and busy workers.

In this tutorial, we will learn how to install and use Mod_status on the Apache web server running on Ubuntu-14.04.

Requirements

  • A server running Ubuntu-14.04 with Apache installed.
  • A non-root user with sudo privileges setup on your server.

Enable mod_status in Apache

By default Apache comes with mode_status enabled. You can check the contents of apache's enabled modules directory by running the following command:

ls /etc/apache2/mods-enabled

You should see the mod_status module in the following output:

    access_compat.load  authn_file.load  autoindex.load  env.load          mpm_prefork.load  rewrite.load        spdy.load    wsgi.conf
    alias.conf          authz_core.load  deflate.conf    filter.load       negotiation.conf  setenvif.conf       ssl.conf     wsgi.load
    alias.load          authz_host.load  deflate.load    mime.conf         negotiation.load  setenvif.load       ssl.load
    auth_basic.load     authz_user.load  dir.conf        mime.load         php5.conf         socache_shmcb.load  status.conf
    authn_core.load     autoindex.conf   dir.load        mpm_prefork.conf  php5.load         spdy.conf           status.load

If mod_status module not enabled, then you can easily enable it by running the following command:

sudo a2enmod status

Configure Mod_status Module

In order to enable the access of mod status page, you will need to configure mod_status default configuration file located at /etc/apache2/mods-enabled/ directory.

Open the status.conf file using your favorite editor:

sudo nano /etc/apache2/mods-enabled/status.conf

Find the section Location /server-status, it should look like following.


SetHandler server-status Require host example.com

Now, change all lines as shown below. where remote-ip-address is the IP address of the remote computer you will be using to access your web server:


SetHandler server-status Require local Require ip remote-ip-address

Once you are finished, save and close the file.

The above configuration is valid only for your default apache site, if you have created virtual hosts, then will need to configure the above settings for each virtual host.

You can do this by editing 000-default.conf file:

sudo nano /etc/apache2/sites-enabled/000-default.conf

Add the following lines under the section VirtualHost *:80:


SetHandler server-status Require local Require ip remote-ip-address

Now, save the file and restart apache service.

sudo /etc/init.d/apache2 restart

Test Mod_status

Once you have finished, it's time to test the mod_status module.

From your remote computer, open your web browser and access the Apache status page using the URL http://your-server-ip/server-status. You should see the following page:

In the above image, you can see that html interface shows you all the information about server load, uptime and process id. You can also refresh the page every 10 seconds by adding ?refresh=10 at the end of the URL.

If you want to view the status of Apache using command line browser called lynx. You can install it by running the following command:

sudo apt-get install lynx

Once installation is complete, you can get the Apache status using the following command:

lynx http://server-ip-address/server-status

You should see the following output:

``` language-bash Apache Server Status for 192.168.43.206 (via 192.168.43.206)

   Server Version: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.19 OpenSSL/1.0.2h mod_wsgi/3.4 Python/2.7.6
   Server MPM: prefork
   Server Built: Jul 15 2016 15:34:04
     _______________________________________________________________________________________________________________________________________

Current Time: Monday, 03-Oct-2016 23:36:16 IST Restart Time: Monday, 03-Oct-2016 23:23:16 IST Parent Server Config. Generation: 1 Parent Server MPM Generation: 0 Server uptime: 12 minutes 59 seconds Server load: 0.00 0.02 0.05 Total accesses: 7 - Total Traffic: 14 kB CPU Usage: u.04 s.05 cu0 cs0 - .0116% CPU load .00899 requests/sec - 18 B/second - 2048 B/request 1 requests currently being processed, 5 idle workers

_____W.......................................................... ................................................................ ......................

Scoreboard Key: "_" Waiting for Connection, "S" Starting up, "R" Reading Request, "W" Sending Reply, "K" Keepalive (read), "D" DNS Lookup, "C" Closing connection, "L" Logging, "G" Gracefully finishing, "I" Idle cleanup of worker, "." Open slot with no current process

Srv PID Acc M CPU SS Req Conn Child Slot Client VHost Request 0-0 2754 0/1/1 _ 0.02 359 3 0.0 0.00 0.00 192.168.43.4 127.0.1.1:80 GET /server-status HTTP/1.1 1-0 2755 0/3/3 _ 0.02 737 0 0.0 0.00 0.00 192.168.43.4 127.0.1.1:80 NULL

2-0 2756 0/1/1 _ 0.02 423 2 0.0 0.00 0.00 192.168.43.4 127.0.1.1:80 NULL 3-0 2757 0/1/1 _ 0.02 234 4 0.0 0.00 0.00 192.168.43.4 127.0.1.1:80 NULL 4-0 2766 0/1/1 _ 0.01 485 3 0.0 0.00 0.00 192.168.43.4 127.0.1.1:80 NULL 5-0 2773 0/0/0 W 0.00 0 0 0.0 0.00 0.00 192.168.43.4 127.0.1.1:80 GET /server-status HTTP/1.0 _______________________________________________________________________________________________________________________________________

Srv Child Server number - generation PID OS process ID Acc Number of accesses this connection / this child / this slot M Mode of operation CPU CPU usage, number of seconds SS Seconds since beginning of most recent request Req Milliseconds required to process most recent request Conn Kilobytes transferred this connection Child Megabytes transferred this child Slot Total megabytes transferred this slot _______________________________________________________________________________________________________________________________________

SSL/TLS Session Cache Status: cache type: SHMCB, shared memory: 512000 bytes, current entries: 0 subcaches: 32, indexes per subcache: 88 index usage: 0%, cache usage: 0% total entries stored since starting: 0 total entries replaced since starting: 0 total entries expired since starting: 0 total (pre-expiry) entries scrolled out of the cache: 0 total retrieves since starting: 0 hit, 0 miss total removes since starting: 0 hit, 0 miss

Need Web Hosting? Try ours, it's fast, reliable and feature loaded with support you can depend on. From £1.60 / month.

View Plans