Member-only story

How to get Apache information on the command line ???

Maciej
4 min readJun 21, 2021

--

Introduction

In this post I will summary of how to dump Apache settings and information without changing settings.

Environment

  • Centos 7
  • Apache Server

Configuration files

Get a list of configuration files

How to get a list of Apache conf files from the command line ?? If the mod_info module is loaded, you can list the configuration files even if you have not set.

[root@localhost vagrant]# httpd -t -D DUMP_CONFIG 2>/dev/null | grep '# In' | awk '{print $4}'
/etc/httpd/conf/httpd.conf
/etc/httpd/conf.d/autoindex.conf
/etc/httpd/conf.d/userdir.conf
/etc/httpd/conf.d/welcome.conf

Get the contents of the configuration file

[root@localhost vagrant]# httpd -t -D DUMP_CONFIG 2>/dev/null | grep -v '#'
Listen 80
User apache
Group apache
ServerAdmin root@localhost
<Directory />
AllowOverride none
Require all denied
</Directory>
DocumentRoot "/var/www/html"
<Directory "/var/www">
AllowOverride None
Require all granted
</Directory>
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>…

--

--

Maciej
Maciej

Written by Maciej

DevOps Consultant. I’m strongly focused on automation, security, and reliability.

No responses yet