Eliminar 03-https-nginx.md
This commit is contained in:
@@ -1,126 +0,0 @@
|
|||||||
# 🔐 Habilitar HTTPS en Google Cloud (Nginx + Certbot)
|
|
||||||
|
|
||||||
> ← [Anterior: ☁️ Google Cloud VM](./02-gcloud-vm-n8n.md) | [Volver al índice](../README.md) | Siguiente: [🕷️ Crawl4AI →](./04-crawl4ai-ubuntu.md)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Requisitos previos
|
|
||||||
|
|
||||||
- VM en Google Cloud con Ubuntu 24.04 *(ver [paso anterior](./02-gcloud-vm-n8n.md))*
|
|
||||||
- n8n ya instalado y corriendo con PM2
|
|
||||||
- Un **dominio propio** con un registro **A** apuntando a la IP externa de tu VM:
|
|
||||||
|
|
||||||
```
|
|
||||||
n8n.midominio.com → EXTERNAL_IP_VM
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Paso 1 — Instalar n8n con PM2 (si no lo hiciste aún)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
|
|
||||||
source ~/.bashrc
|
|
||||||
nvm install --lts
|
|
||||||
npm install -g n8n@latest
|
|
||||||
|
|
||||||
npm install -g pm2
|
|
||||||
pm2 start n8n
|
|
||||||
pm2 save
|
|
||||||
pm2 startup
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Paso 2 — Instalar Nginx
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo apt install -y nginx
|
|
||||||
```
|
|
||||||
|
|
||||||
### Crear configuración para n8n
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo nano /etc/nginx/sites-available/n8n
|
|
||||||
```
|
|
||||||
|
|
||||||
Pega el siguiente contenido (reemplaza `n8n.midominio.com` por tu dominio real):
|
|
||||||
|
|
||||||
```nginx
|
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name n8n.midominio.com;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
proxy_pass http://localhost:5678;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Activar el sitio
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo ln -s /etc/nginx/sites-available/n8n /etc/nginx/sites-enabled/
|
|
||||||
sudo nginx -t
|
|
||||||
sudo systemctl reload nginx
|
|
||||||
```
|
|
||||||
|
|
||||||
n8n ya será accesible en `http://n8n.midominio.com`.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Paso 3 — Instalar Certbot para HTTPS
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo apt install -y certbot python3-certbot-nginx
|
|
||||||
```
|
|
||||||
|
|
||||||
Ejecuta el proceso de certificación:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo certbot --nginx -d n8n.midominio.com
|
|
||||||
```
|
|
||||||
|
|
||||||
Durante el proceso:
|
|
||||||
- Acepta los términos de servicio.
|
|
||||||
- Selecciona la opción de **redirigir todo el tráfico a HTTPS**.
|
|
||||||
|
|
||||||
Certbot configurará Nginx automáticamente para usar TLS.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Paso 4 — Verificar acceso
|
|
||||||
|
|
||||||
Abre en tu navegador:
|
|
||||||
|
|
||||||
👉 `https://n8n.midominio.com`
|
|
||||||
|
|
||||||
n8n estará corriendo con **HTTPS válido y seguro** ✅
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Paso 5 — Renovación automática de certificados
|
|
||||||
|
|
||||||
Certbot instala un cron job que renueva los certificados antes de que expiren. Puedes verificarlo con:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo certbot renew --dry-run
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## ✅ Resultado final
|
|
||||||
|
|
||||||
Con esta configuración tienes:
|
|
||||||
|
|
||||||
- ✅ **n8n corriendo en segundo plano** con PM2
|
|
||||||
- ✅ **Acceso seguro** vía Nginx + HTTPS (Let's Encrypt)
|
|
||||||
- ✅ **Firewall en GCP** abierto solo en puertos `80` y `443` (ya no necesitas exponer el `5678`)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
> ← [Anterior: ☁️ Google Cloud VM](./02-gcloud-vm-n8n.md) | [Volver al índice](../README.md) | Siguiente: [🕷️ Crawl4AI →](./04-crawl4ai-ubuntu.md)
|
|
||||||
Reference in New Issue
Block a user