Mostrando entradas con la etiqueta apache. Mostrar todas las entradas
Mostrando entradas con la etiqueta apache. Mostrar todas las entradas

viernes, 6 de septiembre de 2013

Cómo hacer strace a un Apache

Hola,

¿Cómo podemos llegar más a fondo que la información que nos dan los logs de apache? Por ejemplo las llamadas al sistema, ficheros que se abren, etc...

Una forma elegante usando strace, por ejemplo con:
strace -f -s 4096 -o /tmp/asd.out `pgrep apache| awk '{print "-p "$1}'|xargs` 
Si abrimos otro terminal con una sesion SSH y hacermos un tail de /tmp/asd.out, podremos ir viendo como se atiende cada petición HTTP
tail -f /tmp/asd.out
>4) = 548
5257  poll([{fd=11, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout)
5257  write(11, "-\0\0\0\3select type,value from cdef_items where id=7", 49^C

Analizando el strace lanzado:

-t Trace child processes as they are created by currently traced processes as a result of the fork(2) system call.

-s Specify the maximum string size to print (the default is 32).  Note that filenames are not  considered  strings  and  are  always printed in full

-o Fichero de salida

-p El PID que queremos stracear (Como apache tiene varios PIDS, hacemos el subcomando `pgrep apache| awk ... que nos dara una salia << -p pidApache_1 -p pidApache_2 >>

Saludos

lunes, 17 de mayo de 2010

Apache2 - Ocultar ficheros

Para denegar el acceso a diferentes ficheros en el Document Root o cualquier directorio tenemos el siguiente ejemplo

<Location ~ "(.Xauthority|.bash_history|.profile|.rhosts|.sh_history|.ssh|.subversion|.sunw|.bashrc|.svn)">
Order allow,deny
Deny from all
</Location>


Este denegaria el acceso a los ficheros (.bash_history |.profile| .rhosts| .sh_history| .ssh|.subversion| .sunw|.bashrc|.svn) del directorio Document Root.

miércoles, 27 de mayo de 2009

Fatal error: Class 'HttpRequest' not found in /var/www/index.php on line 2

he installation guideline is very insufficient. I've installed for Debian lenny/sid with the following step;

apt-get install php5-dev (to enable pecl command)
apt-get install libcurl3 (to get curl support)
apt-get install libmagic

and

pecl install pecl_http

pecl will download and compile but before that just follow the prompt. If the respective development library is not available in your system, the compilation will abort.

You should add "extension=http.so" to php.ini