Apache puede iniciarse, detenerse o reiniciarse utilizando cualquiera de los siguientes métodos en sistemas similares a Linux o Unix. Primero, inicia sesión en tu servidor web utilizando el cliente ssh o directamente en la consola, luego escribe los siguientes comandos según tu variante Linux o Unix.
Comandos específicos de Debian Linux / Ubuntu Linux para iniciar, detener o reiniciar Apache
Puedes usar el servicio o el comando /etc/init.d/ de la siguiente manera en Debian Linux versión 7.xo Ubuntu Linux versión Ubuntu 14.10 o anterior :
Reiniciar el servidor web Apache 2:
# /etc/init.d/apache2 restart
o
$ sudo /etc/init.d/apache2 restart
o
$ sudo service apache2 restart
Detener el servidor web Apache 2:
# /etc/init.d/apache2 stop
o
$ sudo /etc/init.d/apache2 stop
o
$ sudo service apache2 stop
Iniciar el servidor web Apache 2:
# /etc/init.d/apache2 start
o
$ sudo /etc/init.d/apache2 start
o
$ sudo service apache2 start
Para los usuarios de Debian / Ubuntu Linux systemd
Utilicen el comando systemctl en Debian Linux versión 8.x + o Ubuntu Linux versión Ubuntu 15.04+ o superior :
## Iniciar Apache ## systemctl start apache2.service ## Detener Apache ## systemctl stop apache2.service ## Reiniciar Apache ## systemctl restart apache2.service
CentOS / RHEL (Red Hat) Linux versión 4.x / 5.x / 6.xo y anteriores
## Iniciar Apache ## service httpd start ## Detener Apache ## service httpd stop ## Reiniciar Apache ## service httpd restart
CentOS / RHEL (Red Hat) Linux versión 7.xo comandos más recientes
La distribución más moderna ahora usa systemd, por lo que debes usar el siguiente comando:
## Iniciar Apache ## systemctl start httpd.service ## Detener Apache ## systemctl stop httpd.service ## Reiniciar ## systemctl restart httpd.service
Método genérico para iniciar, detener o reiniciar Apache en Linux / Unix
La sintaxis es la siguiente (debe ejecutarse como usuario root):
## Detener Apache ## apachectl -k stop ## Reiniciar Apache ## apachectl -k restart ## Reinicio Elegante Apache ## apachectl -k graceful ## Iniciar Apache ## apachectl -f /path/to/your/httpd.conf apachectl -f /usr/local/apache2/conf/httpd.conf