How can I view the complete httpd configuration?

前端 未结 5 1478
梦谈多话
梦谈多话 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:13

    As described in the Apache HTTP Server Documentation

    If the config define -DDUMP_CONFIG is set, mod_info will dump the pre-parsed configuration to stdout during server startup.

    httpd -DDUMP_CONFIG -k start
    

    DUMP_CONFIG requires mod_infoenabled: a2enmod info!

    In Ubuntu do the following

    sudo apache2ctl -DDUMP_CONFIG
    

    If you want to strip the line numbers do

    sudo apache2ctl -DDUMP_CONFIG | grep -vE "^[ ]*#[ ]*[0-9]+:$"
    

    or redirect to a file

    sudo apache2ctl -DDUMP_CONFIG | grep -vE "^[ ]*#[ ]*[0-9]+:$" > /path/to/dump.conf
    

    Known Limitations

    mod_info provides its information by reading the parsed configuration, rather than reading the original configuration file. There are a few limitations as a result of the way the parsed configuration tree is created:

    • Directives which are executed immediately rather than being stored in the parsed configuration are not listed. These include ServerRoot, LoadModule, and LoadFile.
    • Directives which control the configuration file itself, such as Include, and are not listed, but the included configuration directives are.
    • Comments are not listed. (This may be considered a feature.)
    • Configuration directives from .htaccess files are not listed (since they do not form part of the permanent server configuration).
    • Container directives such as are listed normally, but mod_info cannot figure out the line number for the closing .
    • Directives generated by third party modules such as mod_perl might not be listed.

提交回复
热议问题