GNU/Linux >> Tutoriales Linux >  >> Debian

Configure Supervisor para ejecutar el servidor web Apache2 en Ubuntu/Debian Linux

La idea de iniciar sus servicios bajo la supervisión de Supervisor es poder ejecutar múltiples servicios bajo un solo demonio. Dependiendo de la configuración del Supervisor, podrá iniciar, detener o reiniciar cualquier servicio dado como un proceso secundario. En esta configuración mostramos cómo ejecutar apache2 como servicio supervisado (útil para imágenes docker, etc.) en Ubuntu/Debian Linux.
Primero, instale supervisor:

# apt-get install supervisor

Incluir apache2 configuración del supervisor en /etc/supervisor/conf.d/ . Supervisor elegirá cualquier archivo de configuración de este directorio donde el único requisito es *.conf extensión de archivo. Por ejemplo, inserte las siguientes líneas en un nuevo archivo /etc/supervisor/conf.d/apache2.conf :

[program:apache2]
command=/usr/sbin/apache2ctl -DFOREGROUND

Una vez que haya incluido el archivo de configuración anterior, detenga el servidor web apache2 si se está ejecutando actualmente:

# /etc/init.d/apache2 stop  
[ ok ] Stopping web server: apache2.
root@4e004b451a98:/# /etc/init.d/apache2 status
[FAIL] apache2 is not running ... failed!

y reiniciar supervisor:

# /etc/init.d/supervisor restart
Restarting supervisor: supervisord.

Una vez que haya reiniciado el supervisor, también se debe iniciar el servidor web apache2. Confirme que el servidor web apache2 se está ejecutando:

# /etc/init.d/apache2 status
[ ok ] apache2 is running.

Resolución de problemas

si por alguna razón no puede hacer que apache se ejecute bajo el supervisor, ejecute el supervisor en nodaemon modo:

# /etc/init.d/supervisor stop
Stopping supervisor: supervisord.
# supervisord -n

Mensaje de error:

/usr/lib/python2.7/dist-packages/supervisor/options.py:296: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
  'Supervisord is running as root and it is searching '
2015-05-07 01:21:00,849 CRIT Supervisor running as root (no user in config file)
2015-05-07 01:21:00,849 WARN Included extra file "/etc/supervisor/conf.d/apache2.conf" during parsing
2015-05-07 01:21:00,858 INFO RPC interface 'supervisor' initialized
2015-05-07 01:21:00,858 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2015-05-07 01:21:00,858 INFO supervisord started with pid 542
2015-05-07 01:21:01,862 INFO spawned: 'apache2' with pid 545
2015-05-07 01:21:01,914 INFO exited: apache2 (exit status 0; not expected)
2015-05-07 01:21:02,918 INFO spawned: 'apache2' with pid 548
2015-05-07 01:21:02,970 INFO exited: apache2 (exit status 0; not expected)
2015-05-07 01:21:04,975 INFO spawned: 'apache2' with pid 551
2015-05-07 01:21:05,025 INFO exited: apache2 (exit status 0; not expected)
2015-05-07 01:21:08,031 INFO spawned: 'apache2' with pid 554
2015-05-07 01:21:08,078 INFO exited: apache2 (exit status 0; not expected)
2015-05-07 01:21:09,079 INFO gave up: apache2 entered FATAL state, too many start retries too quickly

Si ve el mensaje de error anterior, asegúrese de que su servidor web Apache no se esté ejecutando ya.

Otro mensaje de error que puede ver es:

AH00526: Syntax error on line 74 of /etc/apache2/apache2.conf:
Invalid Mutex directory in argument file:${APACHE_LOCK_DIR}

Esto se debe a que está intentando ejecutar apache2 manda directamente. Puede intentar ejecutar apache2ctl en su lugar.


Debian
  1. Cómo volver a compilar el servidor web nginx en Debian Linux

  2. Cómo configurar el servidor FTP en Debian 9 Stretch Linux

  3. MX Linux frente a Ubuntu

  4. Cómo instalar y configurar Node.js y npm en Ubuntu, Debian o Linux Mint

  5. ¿Cómo configurar PHP CLI en linux ubuntu para ejecutar como www-data?

Instale y configure GlusterFS en Ubuntu 16.04 / Debian 8

Configurar el cliente LDAP en Ubuntu 16.04 / Debian 8

Cómo instalar y configurar KVM en Debian 11 Bullseye Linux

Cómo instalar sudo en Debian o Ubuntu Linux

Cómo instalar y configurar XAMPP en Ubuntu Linux

Cómo instalar y configurar Nagios en Ubuntu Linux