Servizo de Apache
Apache Server execútase como un servizo, polo que será un proceso que está correndo de fondo.
Estado de Apache Server
Para consultar o estado do servizo de Apache Server, debemos executar o seguinte comando:
$ systemctl status apache2
Saída do comando
$ systemctl status apache2
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2020-10-27 20:48:33 CET; 2min 6s ago
Docs: https://httpd.apache.org/docs/2.4/
Main PID: 2831 (apache2)
Tasks: 55 (limit: 4615)
Memory: 6.1M
CGroup: /system.slice/apache2.service
├─2831 /usr/sbin/apache2 -k start
├─2832 /usr/sbin/apache2 -k start
└─2833 /usr/sbin/apache2 -k start
oct 27 20:48:33 pc systemd[1]: Starting The Apache HTTP Server...
oct 27 20:48:33 pc apachectl[2830]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the>
oct 27 20:48:33 pc systemd[1]: Started The Apache HTTP Server.
lines 1-15/15 (END)
Podes empregar ← ↑ → ↓ para desprazarte pola información mostrada e Q para saír.
A propiedade Active poderá ter os seguintes valores:
active (running): Apache está executándose correctamente.inactive (dead): Apache non se está execuantdo.failed: Apache non se está execuantdo porque se producíu un error.
Como calquera servizo, podemos arrancalo, paralo ou reinicialo. Os comandos, no caso de executarse correctamente, non mostran ningunha saída.
Arrancar Apache Server
$ sudo systemctl start apache2
Parar Apache Server
$ sudo systemctl stop apache2
Reiniciar Apache Server
$ sudo systemctl restart apache2
O comando de reinicio de Apache é equivalente a executar o seguinte:
$ sudo systemctl stop apache2
$ sudo systemctl start apache2
Se queres comprobar que calquera das operacións anteriores se levou a cabo correctamente (arranque, parada ou reinicio), podes executar o comando de comprobación do estado de Apache Server despois de executar un deles. Por exemplo:
$ sudo systemctl stop apache2
$ systemctl status apache2
Saída dos comandos
$ sudo systemctl stop apache2
$ systemctl status apache2
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Tue 2020-10-27 20:53:12 CET; 3s ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 3940 ExecStop=/usr/sbin/apachectl stop (code=exited, status=0/SUCCESS)
Main PID: 2831 (code=exited, status=0/SUCCESS)
oct 27 20:48:33 pc systemd[1]: Starting The Apache HTTP Server...
oct 27 20:48:33 pc apachectl[2830]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the>
oct 27 20:48:33 pc systemd[1]: Started The Apache HTTP Server.
oct 27 20:53:11 pc systemd[1]: Stopping The Apache HTTP Server...
oct 27 20:53:11 pc apachectl[3942]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the>
oct 27 20:53:12 pc systemd[1]: apache2.service: Succeeded.
oct 27 20:53:12 pc systemd[1]: Stopped The Apache HTTP Server.
lines 1-14/14 (END)
Recorda pulsar Q para saír do comando.