Autor Tema: Apache2 no reinicia  (Leído 16348 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado Amon-K

  • Full Member
  • ***
  • Mensajes: 208
    • Ver Perfil
    • MeteoPG
  • Estación: Puente Genil - ESAND1400000014500A
Re:Apache2 no reinicia
« Respuesta #15 en: 15 de Enero del 2017, 12:27:01 pm »
Cuando Apache2 se inicia no encuentra el directorio/var/log/apache2, el cual se crea despues y por tanto Apache2 no permanece ejecutandose, y el problema se soluciona también creando el directorio /var/log/apache2 antes de que Apache2 se inicie.

A lo largo del tiempo jantoni ha dado dos soluciones a este problema, que yo conozca.

La primera es modificar /etc/init.d/apache2 incluyendo las siguiente líneas marcadas en rojo:

..........
..........
ENV="env -i LANG=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
if [ "$APACHE_CONFDIR" != /etc/apache2 ] ; then
   ENV="$ENV APACHE_CONFDIR=$APACHE_CONFDIR"
fi
if [ "$APACHE_ENVVARS" != "$APACHE_CONFDIR/envvars" ] ; then
   ENV="$ENV APACHE_ENVVARS=$APACHE_ENVVARS"
fi

#Crea el directorio /var/log/apache2
if [ -d /var/log/apache2 ]
  then
    echo ""
  else
    mkdir /var/log/apache2
    chmod 777 /var/log/apache2
fi


#edit /etc/default/apache2 to change this.
HTCACHECLEAN_RUN=auto
HTCACHECLEAN_MODE=daemon
HTCACHECLEAN_SIZE=300M
HTCACHECLEAN_DAEMON_INTERVAL=120
HTCACHECLEAN_PATH=/var/cache/apache2$DIR_SUFFIX/mod_cache_disk
HTCACHECLEAN_OPTIONS=""
.........
.........

Esta solución es la que yo estoy utilizando y creo que es la mejor, no obstante la segunda es modificar /etc/rc.local incluyendo las lineas en rojo:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

#Crea el directorio de log de Apache y lo inicia
/etc/init.d/apache2 stop
mkdir /var/log/apache2
/etc/init.d/apache2 start



exit 0

Saludos
« Última modificación: 15 de Enero del 2017, 12:28:46 pm por Amon-K »
  ESAND1400000014500A http://meteopg.ddns.net Davis VP2 + Raspberry Pi 2 + Weewx 3.7.1

Desconectado sunbloquer

  • Jr. Member
  • **
  • Mensajes: 94
    • Ver Perfil
    • @pump_upp - best crypto pumps on telegram !
  • Estación: Quintes - Asturias - ESAST3300000033314A
Re:Apache2 no reinicia
« Respuesta #16 en: 15 de Enero del 2017, 21:30:01 pm »
Gracias Amon-K, de momento tengo anulado escribir en RAM, cuando tenga tiempo le meto mano  plau2