Saltar al contenido

cuaderno de campo

anotaciones

Menú
  • casa
    • dinou del carrer nou
  • cocina
    • pan
    • repostería
    • verdura
  • huerto
    • instrucciones sobre el huerto
    • plano del número 29
    • huerto del año 2025
  • humanidades
    • fonoteca
    • galería
  • juego
    • colección de roms
    • steamos en steam deck
    • lista de juego
    • dosbox
  • linux
    • bash
    • sistema operativo
    • ssh
  • web
    • apache
    • css
    • html5
    • javascript
    • mysql
    • php
Menú

apache2: depuración

Publicada el 25 de octubre de 201726 de febrero de 2021 por ernesto
  • apache2ctl
  • obtención de cabeceras
  • módulos de apache
  • archivos de registro o logs
    • access.log
    • error.log

apache2ctl

  1. se puede comprobar la configuración del servidor vía apache2ctl: con -S, este comando «show[s] parsed vhost settings» y «show[s] parsed run settings»:

    apache2ctl -S
    VirtualHost configuration:
    192.168.1.7:9700 RB (/etc/apache2/sites-enabled/RB.conf:1)
    ServerRoot: "/etc/apache2"
    Main DocumentRoot: "/var/www/html"
    Main ErrorLog: "/var/log/apache2/error.log"
    Mutex default: dir="/var/lock/apache2" mechanism=fcntl
    Mutex mpm-accept: using_defaults
    Mutex watchdog-callback: using_defaults
    Mutex rewrite-map: using_defaults
    PidFile: "/var/run/apache2/apache2.pid"
    Define: DUMP_VHOSTS
    Define: DUMP_RUN_CFG
    User: name="www-data" id=33 not_used
    Group: name="www-data" id=33 not_used

  2. con -L, «list[s] available configuration directives»:

    apache2ctl -L
    <Directory (core.c)
    Container for directives affecting resources located in the specified directories
    Allowed in *.conf only outside <Directory>, <Files>, <Location>, or <If>
    <Location (core.c)
    Container for directives affecting resources accessed through the specified URL paths
    Allowed in *.conf only outside <Directory>, <Files>, <Location>, or <If>
    <VirtualHost (core.c)
    Container to map directives to a particular virtual host, takes one or more host addresses
    [...]

  3. con -M, «show[s] all loaded modules»:

    apache2ctl -M
    Loaded Modules:
    core_module (static)
    so_module (static)
    watchdog_module (static)
    http_module (static)
    log_config_module (static)
    logio_module (static)
    version_module (static)
    [...]

obtención de cabeceras

  1. las cabeceras se pueden obtener vía wget:

    wget -S 192.168.1.7:9700/index.php
    converted 'http://192.168.1.7:9700/index.php' (ISO-8859-15) -> 'http://192.168.1.7:9700/index.php' (UTF-8)
    --2017-10-25 21:47:32-- http://192.168.1.7:9700/index.php
    Conectando con 192.168.1.7:9700... conectado.
    Petición HTTP enviada, esperando respuesta...
    HTTP/1.1 200 OK
    Date: Wed, 25 Oct 2017 19:47:32 GMT
    Server: Apache/2.4.10 (Raspbian)
    Set-Cookie: PHPSESSID=hr0b75o0amt31780pvtvubrg67; path=/
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    Pragma: no-cache
    Vary: Accept-Encoding
    Content-Length: 879
    Keep-Alive: timeout=5, max=25
    Connection: Keep-Alive
    Content-Type: text/html; charset=UTF-8
    Longitud: 879 [text/html]

  2. también se pueden consultar mediante firefox:
    1. herramientas > desarrollador web > consola web > peticiones / red

      GET http://192.168.1.7:9700/index.php [HTTP/1.1 200 OK 31ms]

    2. cabeceras > cabeceras de la petición [cliente]

      Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
      Accept-Encoding gzip, deflate
      Accept-Language es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3
      Connection keep-alive
      Cookie compact_display_state=true; PHPSESSID=sgp9fmuhhdsu4r6oirau8h1u34
      DNT 1
      Host 192.168.1.7:9700
      Referer http://192.168.1.7:9700/index.php
      Upgrade-Insecure-Requests 1
      User-Agent Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:56.0) Gecko/20100101 Firefox/56.0

    3. cabeceras > cabeceras de la respuesta [servidor]

      Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0
      Connection Keep-Alive
      Content-Encoding gzip
      Content-Length 2861
      Content-Type text/html; charset=UTF-8
      Date Wed, 25 Oct 2017 16:54:18 GMT
      Expires Thu, 19 Nov 1981 08:52:00 GMT
      Keep-Alive timeout=5, max=25
      Pragma no-cache
      Server Apache/2.4.10 (Raspbian)
      Set-Cookie PHPSESSID=k1ugpdi0f516q8g9gms7hk5s00; path=/
      Vary Accept-Encoding

módulos de apache

  1. si alguna de las directivas de apache no responde o no ofrece las cabeceras correspondientes, puede que el módulo correspondiente no esté cargado:

    apache2ctl -M
    [...]
    deflate_module (shared)
    dir_module (shared)
    env_module (shared)
    filter_module (shared)
    headers_module (shared)
    [...]

    fuera de ifmodule, la directiva cuyo módulo no está cargado provoca un error interno del servidor (es una manera de probarlo). los módulos disponibles de apache2 están en /etc/apache2/mods-available/:

    ls /etc/apache2/mods-available/

    y, mediante a2enmod, se puede cargar el módulo deseado:

    sudo a2enmod headers

    luego, es necesario (claro) reiniciar el servicio.

archivos de registro o logs

  1. access.log

    tail -f /media/web/log/access.log
    192.168.1.5 - - [31/Oct/2017:17:32:47 +0100] "GET /edicion/publico/index.php HTTP/1.1" 500 807 "http://192.168.1.3:9300/edicion/publico/editor.php?f=auxiliares&i=B" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:56.0) Gecko/20100101 Firefox/56.0"

     

  2. error.log

    tail -f /media/web/log/error.log
    [Tue Oct 31 17:32:47.816257 2017] [core:alert] [pid 1239] [client 192.168.1.5:58826] /media/web/edicion/publico/.htaccess: Missing envariable expression for SetEnvIfNoCase, referer: http://192.168.1.3:9300/edicion/publico/editor.php?f=auxiliares&i=B

     

  3. la ubicación de estos archivos de registro se declara en /etc/apache2/sites-available/RB.conf:

    ErrorLog /media/web/log/error.log
    CustomLog /media/web/log/access.log combined

Etiquetado como a2enmod, apache2ctl, tail, wget
  • htaccess: configuración

    creación del archivo: touch /media/web/.htaccess si se tiene acceso al servidor apache (a su configuración),…

  • apache2: instalación y configuración

    instalación y configuración sudo apt-get install apache2 sudo nano /etc/apache2/apache2.conf Timeout 30 MaxKeepAliveRequests 25 sudo…

  • desactivación de las etags

    FileETag None <IfModule mod_headers.c> Header unset ETag </IfModule> esta es la manera de excluir el…

RSS rutas fuera

  • CAMINANDO ENTRE MONSTRUOS 04 (Bestiario Sonoro): Drac de Na Coca 23 de octubre de 2025 Javier Resines
  • Karbach Brewery Rodeo Clown Double IPA (2025) 22 de octubre de 2025 Brett Stevens
  • Beats and yelling: Cultic 22 de octubre de 2025 Hate Meditations
  • Beats and yelling shorts, 20th October 25 20 de octubre de 2025 Hate Meditations
  • Karbach Brewery Hopadillo Imperial IPA (2025) 20 de octubre de 2025 Brett Stevens
  • Eureka Heights Final Boss Imperial IPA (2025) 20 de octubre de 2025 Brett Stevens
  • Tertulia con Juan Gomez, Pablo Vergel y Álvaro Martín: Spring-heeled Jack 19 de octubre de 2025 Javier Resines
  • Beats and yelling: Heruvim 17 de octubre de 2025 Hate Meditations
  • Please read the following scenario carefully 15 de octubre de 2025 Hate Meditations

Archivo

cuaderno de campo 2011-2025