lunes, 6 de septiembre de 2010

FreeBSD 7/8: apache cgi-bin test

Necesitamos correr unos cgi-bin para apcupsd en FreeBSD, segun husmeando el directorio de apache tenemos esto:

/usr/local/www/apache22/cgi-bin

Ahi aparecen 2 archivos de prueba:
  • printenv
  • test-cgi
Ahora si nos vamos aun navegador a ejecutarlos nos dice que:

****************************************************************

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

****************************************************************

Bien vamos viendo que dicen los logs de apache:

[Mon Sep 06 11:58:59 2010] [error] [client 192.168.90.31] (13)Permission denied: exec of '/usr/local/www/apache22/cgi-bin/printenv' failed
[Mon Sep 06 11:58:59 2010] [error] [client 192.168.90.31] Premature end of script headers: printenv

mmmm permiso denegado, ahora los archivos cgi-bin son alfinal de cuentas scripts hechos por lo comun en perl.

Vamos dondo los permisos de ejecucion como cualquier script perl, bash, sh, etc.

chmod +x test-cgi

Probamos:

CGI/1.0 test script report:

argc is 0. argv is .

SERVER_SOFTWARE = Apache/2.2.16 (FreeBSD) mod_ssl/2.2.16 OpenSSL/0.9.8e DAV/2 PHP/5.3.3 with Suhosin-Patch
SERVER_NAME = 192.168.90.3
GATEWAY_INTERFACE = CGI/1.1
SERVER_PROTOCOL = HTTP/1.1
SERVER_PORT = 80
REQUEST_METHOD = GET
HTTP_ACCEPT = text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
PATH_INFO =
PATH_TRANSLATED =
SCRIPT_NAME = /cgi-bin/test-cgi
QUERY_STRING =
REMOTE_HOST =
REMOTE_ADDR = 192.168.90.31
REMOTE_USER =
AUTH_TYPE =
CONTENT_TYPE =
CONTENT_LENGTH =

Listo, ya se que puedo crear mis scripts y subirlos a mi servidor, saludos!!!

No hay comentarios: