How can I view the complete httpd configuration?

前端 未结 5 1481
梦谈多话
梦谈多话 2021-01-30 15:48

I\'m trying to figure out what is the full complete configuration of an httpd setup.

All the configurations files are scattered in different files (/etc/httpd/conf.d,

5条回答
  •  无人及你
    2021-01-30 16:17

    I have a script (alas, in Perl; forgive me, its old) that flattens the configuration files, removes comments (by default) and includes # FILE comments so you can figure out which file contains the thing you might be looking for.

    I've written it with Apache httpd, although its also seen use with Oracle OHS

    https://github.com/cameronkerrnz/scriptorium/blob/master/httpd-dump-config

    Particularly useful for comparing configurations on different machines with SSH and diff/meld/etc.

    Example:

    httpd-dump-config | grep -i -e '# FILE:' -e servername -e serveralias
    # FILE: /etc/httpd/conf/maintenance-curtain.conf
    # FILE: /etc/httpd/conf.d/proxy.conf
    # FILE: /etc/httpd/otago/secure-www.alias.conf
    # FILE: /etc/httpd/conf.d/proxy.conf
        ServerName www.otago.ac.nz
        ServerAlias otago.ac.nz
    

    Here's an example using diff (CLI) and meld (GUI):

    diff -Bb <(httpd-dump-config) <(ssh root@revproxy2 httpd-dump-config)
    
    meld <(httpd-dump-config) <(ssh root@revproxy2 httpd-dump-config) &
    

    I've used this a lot over the years when navigating a config with thousands of lines of config spread over many files.

提交回复
热议问题