Practica Unidad 10: Nginx y SSL

Author

Diego Saavedra

Published

Feb 2, 2026

Practica Unidad 10: Nginx y SSL

Objetivo

Instalar Nginx, configurar un sitio (server block) y entregar evidencias. (Certbot es opcional si no tienes dominio publico).


Parte 1: Instalacion y validacion

BASH
1$ sudo apt update


2$ sudo apt install -y nginx


3$ systemctl status nginx --no-pager
 nginx.service - A high performance web server and a reverse proxy server
     Active: active (running)


4$ curl -I http://localhost
HTTP/1.1 200 OK
Server: nginx/1.24.0 (Ubuntu)
1
apt update actualiza el indice.
2
apt install nginx instala Nginx.
3
systemctl status valida servicio.
4
curl -I valida respuesta.

Parte 2: Server block

BASH
1$ sudo tee /etc/nginx/sites-available/app.conf >/dev/null <<'EOF'
server {
  listen 80;
  server_name app.local;
  location / { return 200 "app ok\n"; }
}
EOF


2$ sudo ln -sf /etc/nginx/sites-available/app.conf /etc/nginx/sites-enabled/app.conf


3$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful


4$ sudo systemctl reload nginx


5$ curl -i -H 'Host: app.local' http://127.0.0.1/
HTTP/1.1 200 OK
Server: nginx

app ok
1
tee + heredoc crea el sitio.
2
ln -sf habilita el sitio.
3
nginx -t valida configuracion.
4
systemctl reload aplica.
5
curl -H Host prueba el server block.

Parte 3 (opcional): Certbot

BASH
1$ sudo apt install -y certbot python3-certbot-nginx


2$ sudo certbot --nginx -d tu-dominio.com


3$ sudo certbot renew --dry-run
1
apt install certbot instala Certbot.
2
certbot –nginx emite certificado y configura TLS.
3
certbot renew –dry-run valida renovacion.

Checklist de aceptación

Code Appendix