Posso ver a configuração resolvida que o Apache está usando?

3

Existe uma maneira de ver a configuração final "efetiva" que uma instância do Apache em execução está usando depois de resolver qualquer / todas as inclusões e afins?

Estou vendo uma configuração que tem uma web de includes e suspeito que alguns dos problemas que estou tendo estão relacionados à ordem em que tudo se encaixa. Eu acho que é um apachectl que pode validar uma configuração sem erros de sintaxe, mas eu estou querendo saber se eu posso dar um passo adiante e de alguma forma mostrar a configuração totalmente montada. Algum conselho (menos de limpar essa confusão de coisas que nunca deveriam ter sido permitidas)?

    
por Wilco 02.06.2015 / 20:19

1 resposta

3

Sim, até certo ponto, mas acho que isso cobre sua exigência. Você pode usar mod_info para isso.

Da documentação on-line (ênfase minha):

Dumping the configuration on startup

If the config define -DDUMP_CONFIG is set, mod_info will dump the pre-parsed configuration to stdout during server startup. Pre-parsed means that directives like <IfDefine> and <IfModule> are evaluated and environment variables are replaced. However it does not represent the final state of the configuration. In particular, it does not represent the merging or overriding that may happen for repeated directives.

This is roughly equivalent to the ?config query.

e:

[...]views of the configuration information are available by appending a query to the server-info request. For example, http://your.host.example.com/server-info?config will show all configuration directives.

?config

Just the configuration directives, not sorted by module

Como exemplo, para uma configuração padrão no Fedora 22, as linhas marcadas como In file estão incluídas no arquivo principal httpd.conf :

# curl -v http://localhost/server-info?config | elinks -dump
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying ::1...
* Connected to localhost (::1) port 80 (#0)
> GET /server-info?config HTTP/1.1
> User-Agent: curl/7.40.0
> Host: localhost
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Tue, 02 Jun 2015 20:49:43 GMT
< Server: Apache/2.4.12 (Fedora)
< Transfer-Encoding: chunked
< Content-Type: text/html; charset=ISO-8859-1
<
{ [8014 bytes data]
100  8561    0  8561    0     0  1792k      0 --:--:-- --:--:-- --:--:-- 2090k
* Connection #0 to host localhost left intact
                       Apache Server Information

   Configuration:
       In file: /etc/httpd/conf/httpd.conf
         42: Listen 80
         66: User apache
         67: Group apache
         86: ServerAdmin root@localhost
        102: <Directory />
        103:   AllowOverride none
        104:   Require all denied
           : </Directory>
        119: DocumentRoot "/var/www/html"
        124: <Directory "/var/www">
        125:   AllowOverride None
        127:   Require all granted
           : </Directory>
        131: <Directory "/var/www/html">
        144:   Options Indexes FollowSymLinks
        151:   AllowOverride None
        156:   Require all granted
           : </Directory>
        164: DirectoryIndex index.html
        171: <Files ".ht*">
        172:   Require all denied
           : </Files>
        182: ErrorLog "logs/error_log"
        189: LogLevel warn
        196: LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\"
       \"%{User-Agent}i\"" combined
        197: LogFormat "%h %l %u %t \"%r\" %>s %b" common
        201: LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\"
       \"%{User-Agent}i\" %I %O" combinedio
        217: CustomLog "logs/access_log" combined
        247: ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
        255: <Directory "/var/www/cgi-bin">
        256:   AllowOverride None
        257:   Options None
        258:   Require all granted
           : </Directory>
        266: TypesConfig /etc/mime.types
        283: AddType application/x-compress .Z
        284: AddType application/x-gzip .gz .tgz
        305: AddType text/html .shtml
        306: AddOutputFilter INCLUDES .shtml
        316: AddDefaultCharset UTF-8
        324: MIMEMagicFile conf/magic
        348: EnableSendfile on
       In file: /etc/httpd/conf.d/autoindex.conf
         16: IndexOptions FancyIndexing HTMLTable VersionSort
         21: Alias /icons/ "/usr/share/httpd/icons/"
         23: <Directory "/usr/share/httpd/icons">
         24:   Options Indexes MultiViews FollowSymlinks
         25:   AllowOverride None
         26:   Require all granted
           : </Directory>
         34: AddIconByEncoding (CMP,/icons/compressed.gif) x-compress
       x-gzip
         36: AddIconByType (TXT,/icons/text.gif) text/*
         37: AddIconByType (IMG,/icons/image2.gif) image/*
         38: AddIconByType (SND,/icons/sound2.gif) audio/*
         39: AddIconByType (VID,/icons/movie.gif) video/*
         41: AddIcon /icons/binary.gif .bin .exe
         42: AddIcon /icons/binhex.gif .hqx
         43: AddIcon /icons/tar.gif .tar
         44: AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
         45: AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
         46: AddIcon /icons/a.gif .ps .ai .eps
         47: AddIcon /icons/layout.gif .html .shtml .htm .pdf
         48: AddIcon /icons/text.gif .txt
         49: AddIcon /icons/c.gif .c
         50: AddIcon /icons/p.gif .pl .py
         51: AddIcon /icons/f.gif .for
         52: AddIcon /icons/dvi.gif .dvi
         53: AddIcon /icons/uuencoded.gif .uu
         54: AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
         55: AddIcon /icons/tex.gif .tex
         56: AddIcon /icons/bomb.gif core.
         58: AddIcon /icons/back.gif ..
         59: AddIcon /icons/hand.right.gif README
         60: AddIcon /icons/folder.gif ^^DIRECTORY^^
         61: AddIcon /icons/blank.gif ^^BLANKICON^^
         67: DefaultIcon /icons/unknown.gif
         85: ReadmeName README.html
         86: HeaderName HEADER.html
         92: IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
       In file: /etc/httpd/conf.d/mod_dnssd.conf
          2: DNSSDEnable on
       In file: /etc/httpd/conf.d/userdir.conf
         17: UserDir disabled
         31: <Directory "/home/*/public_html">
         32:   AllowOverride FileInfo AuthConfig Limit Indexes
         33:   Options MultiViews Indexes SymLinksIfOwnerMatch
       IncludesNoExec
         34:   Require method GET POST OPTIONS
           : </Directory>
       In file: /etc/httpd/conf.d/welcome.conf
          8: <LocationMatch "^/+$">
          9:   Options -Indexes
         10:   ErrorDocument 403 /.noindex.html
           : </LocationMatch>
         13: <Directory /usr/share/httpd/noindex>
         14:   AllowOverride None
         15:   Require all granted
           : </Directory>
         18: Alias /.noindex.html /usr/share/httpd/noindex/index.html
       In file: /etc/httpd/conf/httpd.conf
        355: <Location "/server-info">
        356:   SetHandler server-info
           : </Location>
    
por 02.06.2015 / 22:46