Instalación de Nginx en Debian
Guía para instalar y poner en marcha Nginx en sistemas Linux basados en Debian.
Requerimientos
| Sistema Operativo | Versión |
|---|---|
| Debian | 10 |
Instalación
Actualiza los índices de paquetes.
sudo apt-get updateOpcional: elimina versiones anteriores.
sudo apt-get purge nginx nginx-commonInstala la versión más reciente disponible en los repositorios.
sudo apt install nginxInicia el servicio.
sudo service nginx start
Verificación
Comprueba el estado del servicio.
sudo service nginx status
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2020-06-06 12:17:20 -04; 3s ago
Docs: man:nginx(8)
Process: 3954 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 3955 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 3956 (nginx)
Tasks: 7 (limit: 4915)
Memory: 6.5M
...
Visita http://localhost desde el navegador o usa la terminal para consultar la página por defecto.
curl http://localhost
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>
If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.
</p>
<p>
For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br />
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.
</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
Inicio automático
Controla el inicio automático del servicio.
sudo systemctl enable nginx
Para deshabilitarlo:
sudo systemctl disable nginx
Referencias
Publicado: 6 de junio de 2020