Sur une debian fraichement installée :
# Création des répertoires de l'application
mkdir -p /opt/n8n/certs /opt/n8n/data
# Attribution stricte de la propriété à l'UID de n8n
chown -R 1000:1000 /opt/n8n/data /opt/n8n/certs
# Génération du certificat SSL Local
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout /opt/n8n/certs/key.pem \
-out /opt/n8n/certs/cert.pem \
-subj "/CN=192.168.1.X" \
-addext "subjectAltName = IP:192.168.1.X"
Fichier /opt/n8n/docker-compose.yml
services:
n8n:
image: docker.io/n8nio/n8n:latest
container_name: n8n
restart: unless-stopped
ports:
- "5678:5678"
environment:
# Correctif réseau pour VM sans IPv6
- N8N_LISTEN_ADDRESS=0.0.0.0
# Configuration de l'URL d'accès locale
- WEBHOOK_URL=https://192.168.1.X:5678/
# Activation SSL Native
- N8N_PROTOCOL=https
- N8N_SSL_CERT=/certs/cert.pem
- N8N_SSL_KEY=/certs/key.pem
# Optimisations de production (Doc officielle)
- N8N_DIAGNOSTICS_ENABLED=false
- N8N_VERSION_NOTIFICATIONS_ENABLED=false
- N8N_TEMPLATES_ENABLED=false
volumes:
- /opt/n8n/data:/home/node/.n8n
- /opt/n8n/certs:/certs:ro
Ajouter N8N_BLOCK_ENV_ACCESS_IN_NODE=false pour passer des variables d'environnement.