jueves, 6 de octubre de 2011

Resolver error apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName en Ubuntu

Luego de mi pugna con el modulo RewriteEngine me encontre con otro problema para iniciar apache2

* Restarting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

Probe escribiendo lo siguiente:

gedit /etc/apache2/httpd.conf

Por default el archivo httpd.conf estará en blanco así que solo añado la siguiente linea
ServerName localhost

Guarda el archivo y reinicia el servidor

sudo /etc/init.d/apache2 restart

Ahora el error desaparece pero para mi sorpresa apache continia sin iniciar.

Starting Apache [fail]

Como no tenia el error en la consola me fui a ver el error.log file que ubicaras en

var/log/apache2/error.log

Aqui se guardan los errores del servidor. Bueno pues revisando encontre este error

2)No such file or directory: apache2: could not open error log file /etc/apache2/${APACHE_LOG_DIR}/error.log.Unable to open logs

Parece que tenemos que definir el directorio APACHE_LOG_DIR pero en donde?

Pues se define en etc/apaches2/envvars.

Asegurate que las entradas que hacen referencia a ${APACHE_LOG_DIR} se vean así:

${APACHE_LOG_DIR}/error.log
Algo de este tipo estaria incorrecto(Ese fue mi error)
Code:
/etc/apache2/${APACHE_LOG_DIR}/error.log
Por defecto el archivo /etc/apache2/envvars en apache (2.2.16) se veria asi. EL mio estaba incompleto asi que lo posteo por si lo necesitan.
Code:

# envvars - default environment variables for apache2ctl

# this won't be correct after changing uid
unset HOME

# for supporting multiple apache2 instances
if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
SUFFIX="-${APACHE_CONFDIR##/etc/apache2-}"
else
SUFFIX=
fi

# Since there is no sane way to get the parsed apache2 config in scripts, some
# settings are defined via environment variables and then used in apache2ctl,
# /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
export APACHE_PID_FILE=/var/run/apache2$SUFFIX.pid
export APACHE_RUN_DIR=/var/run/apache2$SUFFIX
export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX
# Only /var/log/apache2 is handled by /etc/logrotate.d/apache2.
export APACHE_LOG_DIR=/var/log/apache2$SUFFIX

## The locale used by some modules like mod_dav
export LANG=C# envvars - default environment variables for apache2ctl

# this won't be correct after changing uid
unset HOME

# for supporting multiple apache2 instances
if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
SUFFIX="-${APACHE_CONFDIR##/etc/apache2-}"
else
SUFFIX=
fi

# Since there is no sane way to get the parsed apache2 config in scripts, some
# settings are defined via environment variables and then used in apache2ctl,
# /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data

export LANG

## The command to get the status for 'apache2ctl status'.
## Some packages providing 'www-browser' need '--dump' instead of '-dump'.
#export APACHE_LYNX='www-browser -dump'

es despues de esto al fin

sudo etc/init.d/apache2 restart

Y listo!!..

Al fin he iniciado mi servidor Apache...Espero les sea de ayuda.

Keep on Learning!!


No hay comentarios: