Skip to main content

Configuring server status and information to be veiwed remotely

By April 12, 2013September 12th, 2022No Comments

Having built our minimal Apache web server we will now start adding to it to gain more understanding of the server, its modules and what they can provide. In this tutorial we are going to take a look at how we can use the shared Apache modules: mod_info and mod_status, so we can view server information and status remotely.

Of course this information should be restricted, for now we restrict access to these locations to a single internal IP address. Do remember you do not have to load these modules and choose carefully what you do load.

As we start to grow the httpd.conf we may choose to split the file into segments and use the Include directive to read in other files as needed. Firstly, we will create a modules.conf file in the server root and conf.d directory, in out case /etc/httpd/conf.d. We will then delete lines that start withLoadModule from the httpd.conf and add those lines to the modules.conf file. To make sure they are still loaded correctly when the Apache web server start we will add the line:

Include conf.d/modules.conf

We add two additional modules to support the server-info and server-status that we require:


		LoadModule authz_host_module modules/
		LoadModule dir_module modules/
		LoadModule info_module modules/
		LoadModule status_module module/

To use these modules we must add some Location directives to the httpd.conf file. One for server-status and the other for server-info. We will restrict access to these locations to a single IP address in this example.


		User apache
		Group apache
		ErrorLog /var/log/httpd/error.log
		Include conf.d/modules.conf
		DirectoryIndex index.html
		DocumentRoot /var/www/html
		<Directory /var/www/html>
        	AllowOverride None
        	Order allow,deny
        	allow from
		<Location /server-status>
		SetHandler server-status
		Order allow,deny
		<Location /server-info>
		SetHandler server-info
		Order allow,deny