diff --git a/backup-conflitti/migrate-to-vm-master.sh b/backup-conflitti/migrate-to-vm-master.sh
new file mode 100755
index 00000000..2c1866cb
--- /dev/null
+++ b/backup-conflitti/migrate-to-vm-master.sh
@@ -0,0 +1,257 @@
+#!/bin/bash
+# π NETGESCON - MIGRAZIONE COMPLETA A VM MASTER
+# Creato: 19/07/2025 - Migrazione da Windows WSL a VM Linux
+
+set -e
+
+echo "π === NETGESCON - MIGRAZIONE COMPLETA A VM MASTER ==="
+echo "π
$(date '+%Y-%m-%d %H:%M:%S')"
+echo ""
+
+# === CONFIGURAZIONI ===
+SOURCE_PATH="/home/michele/netgescon"
+TARGET_SERVER="192.168.0.200"
+TARGET_USER="michele"
+TARGET_PATH="/home/michele/netgescon"
+SSH_TARGET="$TARGET_USER@$TARGET_SERVER"
+
+echo "π Configurazione migrazione:"
+echo " Origine: $SOURCE_PATH (Windows WSL)"
+echo " Destinazione: $SSH_TARGET:$TARGET_PATH"
+echo " Server Master: $TARGET_SERVER"
+echo ""
+
+# === STEP 1: VERIFICA CONNESSIONE ===
+echo "π STEP 1: Verifica connessione e sistema target..."
+
+if ! ssh -o ConnectTimeout=10 "$SSH_TARGET" "echo 'Connessione OK'" >/dev/null 2>&1; then
+ echo "β Impossibile connettersi a $SSH_TARGET"
+ echo " Verifica: rete, SSH, credenziali"
+ exit 1
+fi
+
+echo " β
Connessione SSH OK"
+
+# Verifica sistema target
+ssh "$SSH_TARGET" << 'EOF'
+echo "π Informazioni sistema target:"
+echo " OS: $(lsb_release -d 2>/dev/null | cut -f2 || echo 'Linux')"
+echo " Kernel: $(uname -r)"
+echo " Spazio: $(df -h / | tail -1 | awk '{print $4}') disponibili"
+echo " RAM: $(free -h | grep Mem | awk '{print $7}') libera"
+EOF
+
+# === STEP 2: PREPARAZIONE AMBIENTE TARGET ===
+echo ""
+echo "π§ STEP 2: Preparazione ambiente su VM target..."
+
+ssh "$SSH_TARGET" << 'EOF'
+# Aggiorna sistema
+sudo apt update
+
+# Installa strumenti essenziali
+sudo apt install -y git curl wget rsync build-essential
+
+# Installa stack LAMP base
+sudo apt install -y apache2 mysql-server php8.1 php8.1-mysql php8.1-xml php8.1-mbstring php8.1-zip php8.1-gd php8.1-curl php8.1-cli
+
+# Installa Composer
+if ! command -v composer &> /dev/null; then
+ curl -sS https://getcomposer.org/installer | php
+ sudo mv composer.phar /usr/local/bin/composer
+ sudo chmod +x /usr/local/bin/composer
+fi
+
+# Installa Node.js e npm
+if ! command -v node &> /dev/null; then
+ curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
+ sudo apt install -y nodejs
+fi
+
+# Crea directory di lavoro
+mkdir -p /home/michele/netgescon
+mkdir -p /var/www/netgescon
+mkdir -p /var/git
+
+echo "β
Ambiente target preparato"
+EOF
+
+echo " β
Ambiente VM preparato"
+
+# === STEP 3: TRASFERIMENTO COMPLETO ===
+echo ""
+echo "π¦ STEP 3: Trasferimento completo progetto..."
+
+# Prima sincronizzazione completa
+echo " π Sincronizzazione rsync completa..."
+rsync -avz --progress \
+ --exclude='.git/objects' \
+ --exclude='*.tmp' \
+ --exclude='__pycache__' \
+ --exclude='venv' \
+ --exclude='node_modules' \
+ --exclude='.env' \
+ --exclude='storage/logs/*.log' \
+ "$SOURCE_PATH/" \
+ "$SSH_TARGET:$TARGET_PATH/"
+
+echo " β
Trasferimento file completato"
+
+# === STEP 4: SETUP GIT SU TARGET ===
+echo ""
+echo "π§ STEP 4: Setup Git su VM target..."
+
+ssh "$SSH_TARGET" << 'EOF'
+cd /home/michele/netgescon
+
+# Configura Git
+git config --global user.name "NetGescon Master VM"
+git config --global user.email "master@netgescon.local"
+git config --global init.defaultBranch master
+
+# Re-inizializza repository se necessario
+if [ ! -d ".git" ]; then
+ git init
+ git add .
+ git commit -m "π NETGESCON - Migrazione completa su VM Master
+
+π Migrazione da Windows WSL a VM Linux
+π Repository ricreato su server master
+π
$(date '+%Y-%m-%d %H:%M:%S')
+π― Sistema pronto per sviluppo Linux nativo"
+else
+ # Se esiste giΓ , aggiungi eventuali nuovi file
+ git add .
+ if [ -n "$(git status --porcelain)" ]; then
+ git commit -m "π Sync da Windows WSL $(date '+%Y-%m-%d %H:%M:%S')"
+ fi
+fi
+
+echo "β
Git configurato su VM target"
+EOF
+
+# === STEP 5: SETUP SERVER GIT GITEA ===
+echo ""
+echo "π’ STEP 5: Setup server Git (Gitea) su VM..."
+
+# Trasferisce e esegue script setup Gitea
+scp "$SOURCE_PATH/docs/03-scripts-automazione/setup-git-server-master.sh" "$SSH_TARGET:/tmp/"
+
+ssh "$SSH_TARGET" << 'EOF'
+chmod +x /tmp/setup-git-server-master.sh
+
+# Esegue setup Gitea (richiede sudo)
+echo "π§ Installazione Gitea server..."
+sudo /tmp/setup-git-server-master.sh
+
+echo "β
Server Git configurato"
+EOF
+
+# === STEP 6: CONFIGURAZIONE LARAVEL ===
+echo ""
+echo "π§ STEP 6: Configurazione Laravel su VM..."
+
+ssh "$SSH_TARGET" << 'EOF'
+cd /home/michele/netgescon/netgescon-laravel
+
+# Installa dipendenze Composer
+if [ -f "composer.json" ]; then
+ composer install --no-dev --optimize-autoloader
+fi
+
+# Copia e configura .env
+if [ ! -f ".env" ] && [ -f ".env.example" ]; then
+ cp .env.example .env
+ php artisan key:generate
+fi
+
+# Configura permessi
+sudo chown -R www-data:www-data storage bootstrap/cache
+sudo chmod -R 775 storage bootstrap/cache
+
+echo "β
Laravel configurato"
+EOF
+
+# === STEP 7: CONFIGURAZIONE APACHE ===
+echo ""
+echo "π STEP 7: Configurazione Apache per NetGescon..."
+
+ssh "$SSH_TARGET" << 'EOF'
+# Configurazione VirtualHost Apache
+sudo tee /etc/apache2/sites-available/netgescon.conf > /dev/null << 'APACHE_CONF'
+
+ ServerName netgescon.local
+ DocumentRoot /home/michele/netgescon/netgescon-laravel/public
+
+
+ AllowOverride All
+ Require all granted
+
+
+ ErrorLog ${APACHE_LOG_DIR}/netgescon_error.log
+ CustomLog ${APACHE_LOG_DIR}/netgescon_access.log combined
+
+APACHE_CONF
+
+# Abilita sito e moduli
+sudo a2enmod rewrite
+sudo a2ensite netgescon
+sudo systemctl reload apache2
+
+echo "β
Apache configurato"
+EOF
+
+# === STEP 8: TEST FINALE ===
+echo ""
+echo "π§ͺ STEP 8: Test configurazione finale..."
+
+ssh "$SSH_TARGET" << 'EOF'
+cd /home/michele/netgescon
+
+echo "π === RIEPILOGO CONFIGURAZIONE VM ==="
+echo "β
Sistema: $(lsb_release -d 2>/dev/null | cut -f2 || echo 'Linux')"
+echo "β
Git: $(git --version)"
+echo "β
PHP: $(php --version | head -1)"
+echo "β
Composer: $(composer --version | head -1)"
+echo "β
Node.js: $(node --version)"
+echo "β
Apache: $(apache2 -v | head -1)"
+echo ""
+
+echo "π Struttura progetto:"
+ls -la /home/michele/netgescon/
+echo ""
+
+echo "π Status Git:"
+git status --short
+echo ""
+
+echo "π Servizi attivi:"
+sudo systemctl is-active apache2 mysql gitea-docker-compose --no-pager
+EOF
+
+# === RIEPILOGO FINALE ===
+echo ""
+echo "π === RIEPILOGO MIGRAZIONE COMPLETA ==="
+echo "β
VM target preparata e configurata"
+echo "β
Progetto NetGescon trasferito completamente"
+echo "β
Git repository configurato su VM"
+echo "β
Server Git (Gitea) installato"
+echo "β
Stack LAMP configurato"
+echo "β
Laravel pronto per sviluppo"
+echo ""
+
+echo "π Accesso VM:"
+echo " SSH: ssh $SSH_TARGET"
+echo " Web: http://$TARGET_SERVER (NetGescon)"
+echo " Git: http://$TARGET_SERVER:3000 (Gitea)"
+echo ""
+
+echo "π Prossimi passi:"
+echo "1. π Configurare DNS/hosts per netgescon.local"
+echo "2. π§ Completare setup Gitea via web"
+echo "3. π Creare primo repository in Gitea"
+echo "4. π Push del codice dal VM al Gitea locale"
+echo ""
+
+echo "π― Migrazione completata con successo!"
+echo "π
$(date '+%Y-%m-%d %H:%M:%S')"
diff --git a/backup-conflitti/migrate-vm-manual.sh b/backup-conflitti/migrate-vm-manual.sh
new file mode 100755
index 00000000..9eebf0dd
--- /dev/null
+++ b/backup-conflitti/migrate-vm-manual.sh
@@ -0,0 +1,129 @@
+#!/bin/bash
+# π NETGESCON - MIGRAZIONE SEMPLIFICATA A VM
+# Creato: 19/07/2025 - Versione step-by-step manuale
+
+echo "π === NETGESCON - MIGRAZIONE A VM MASTER ==="
+echo "π
$(date '+%Y-%m-%d %H:%M:%S')"
+echo ""
+
+TARGET_VM="192.168.0.200"
+TARGET_USER="michele"
+
+echo "π Piano migrazione a $TARGET_USER@$TARGET_VM:"
+echo ""
+
+echo "π§ STEP 1: Preparazione ambiente VM"
+echo " Comandi da eseguire sulla VM (SSH):"
+echo ""
+echo " # Aggiorna sistema"
+echo " sudo apt update && sudo apt upgrade -y"
+echo ""
+echo " # Installa stack base"
+echo " sudo apt install -y git curl wget rsync build-essential"
+echo " sudo apt install -y apache2 mysql-server"
+echo " sudo apt install -y php8.1 php8.1-mysql php8.1-xml php8.1-mbstring php8.1-zip php8.1-gd php8.1-curl"
+echo ""
+echo " # Installa Composer"
+echo " curl -sS https://getcomposer.org/installer | php"
+echo " sudo mv composer.phar /usr/local/bin/composer"
+echo ""
+echo " # Crea directory"
+echo " mkdir -p /home/michele/netgescon"
+echo " sudo mkdir -p /var/www/netgescon"
+echo ""
+
+echo "π¦ STEP 2: Trasferimento file"
+echo " Da eseguire da questa macchina Windows:"
+echo ""
+echo " rsync -avz --progress \\"
+echo " --exclude='__pycache__' \\"
+echo " --exclude='venv' \\"
+echo " --exclude='node_modules' \\"
+echo " --exclude='.env' \\"
+echo " /home/michele/netgescon/ \\"
+echo " $TARGET_USER@$TARGET_VM:/home/michele/netgescon/"
+echo ""
+
+echo "π§ STEP 3: Setup Git su VM"
+echo " Sulla VM dopo il trasferimento:"
+echo ""
+echo " cd /home/michele/netgescon"
+echo " git config --global user.name 'NetGescon Master VM'"
+echo " git config --global user.email 'master@netgescon.local'"
+echo " git add ."
+echo " git commit -m 'Migrazione completa su VM Master'"
+echo ""
+
+echo "π’ STEP 4: Setup Gitea (server Git)"
+echo " Sulla VM:"
+echo ""
+echo " # Setup Gitea con Docker"
+echo " sudo docker run -d \\"
+echo " --name=gitea \\"
+echo " --restart=unless-stopped \\"
+echo " -p 3000:3000 \\"
+echo " -p 2222:22 \\"
+echo " -v /var/lib/gitea:/data \\"
+echo " gitea/gitea:latest"
+echo ""
+
+echo "π STEP 5: Configurazione Apache"
+echo " Sulla VM:"
+echo ""
+echo " # VirtualHost NetGescon"
+echo " sudo tee /etc/apache2/sites-available/netgescon.conf << 'EOF'"
+echo " "
+echo " ServerName netgescon.local"
+echo " DocumentRoot /home/michele/netgescon/netgescon-laravel/public"
+echo " "
+echo " AllowOverride All"
+echo " Require all granted"
+echo " "
+echo " "
+echo " EOF"
+echo ""
+echo " sudo a2enmod rewrite"
+echo " sudo a2ensite netgescon"
+echo " sudo systemctl reload apache2"
+echo ""
+
+echo "π§ͺ STEP 6: Test finale"
+echo " http://$TARGET_VM β NetGescon"
+echo " http://$TARGET_VM:3000 β Gitea"
+echo ""
+
+echo "π― Vuoi procedere con il trasferimento automatico? (y/N)"
+read -r response
+
+if [[ "$response" =~ ^[Yy]$ ]]; then
+ echo ""
+ echo "π Avvio trasferimento..."
+
+ echo "π¦ Trasferimento file con rsync..."
+ rsync -avz --progress \
+ --exclude='__pycache__' \
+ --exclude='venv' \
+ --exclude='node_modules' \
+ --exclude='.env' \
+ --exclude='*.log' \
+ /home/michele/netgescon/ \
+ "$TARGET_USER@$TARGET_VM:/home/michele/netgescon/"
+
+ echo ""
+ echo "β
Trasferimento completato!"
+ echo ""
+ echo "π Prossimi passi manuali sulla VM:"
+ echo "1. SSH alla VM: ssh $TARGET_USER@$TARGET_VM"
+ echo "2. Setup ambiente: sudo apt install -y git apache2 mysql-server php8.1..."
+ echo "3. Configurazione Git nel progetto"
+ echo "4. Setup Gitea"
+ echo "5. Configurazione Apache"
+
+else
+ echo ""
+ echo "π Migrazione posticipata."
+ echo " Usa questo script come guida per i passi manuali."
+fi
+
+echo ""
+echo "π
$(date '+%Y-%m-%d %H:%M:%S')"
diff --git a/backup-conflitti/verify-vm-target.sh b/backup-conflitti/verify-vm-target.sh
new file mode 100755
index 00000000..1fdb7e49
--- /dev/null
+++ b/backup-conflitti/verify-vm-target.sh
@@ -0,0 +1,119 @@
+#!/bin/bash
+# π NETGESCON - VERIFICA PRE-MIGRAZIONE
+# Creato: 19/07/2025 - Test connessione e preparazione
+
+echo "π === NETGESCON - VERIFICA PRE-MIGRAZIONE ==="
+echo "π
$(date '+%Y-%m-%d %H:%M:%S')"
+echo ""
+
+TARGET_SERVER="192.168.0.200"
+TARGET_USER="michele"
+
+echo "π Test connessione a VM target: $TARGET_USER@$TARGET_SERVER"
+echo ""
+
+# Test connessione base
+echo "π Test 1: Connessione SSH..."
+if ssh -o ConnectTimeout=10 -o BatchMode=yes "$TARGET_USER@$TARGET_SERVER" "echo 'SSH OK'" 2>/dev/null; then
+ echo " β
SSH con chiavi funziona"
+else
+ echo " β οΈ SSH richiede password (normale)"
+ if ssh -o ConnectTimeout=10 "$TARGET_USER@$TARGET_SERVER" "echo 'SSH con password OK'"; then
+ echo " β
SSH con password funziona"
+ else
+ echo " β SSH non funziona - verificare rete/credenziali"
+ exit 1
+ fi
+fi
+
+# Test sistema target
+echo ""
+echo "π Test 2: Informazioni sistema target..."
+ssh "$TARGET_USER@$TARGET_SERVER" << 'EOF'
+echo " Sistema: $(lsb_release -d 2>/dev/null | cut -f2 || uname -s)"
+echo " Kernel: $(uname -r)"
+echo " Architettura: $(uname -m)"
+echo " Uptime: $(uptime | cut -d',' -f1)"
+echo " Spazio root: $(df -h / | tail -1 | awk '{print $4}') liberi"
+echo " RAM libera: $(free -h | grep Mem | awk '{print $7}')"
+echo " Utente: $(whoami)"
+echo " Home: $HOME"
+EOF
+
+# Test permessi sudo
+echo ""
+echo "π Test 3: Permessi sudo..."
+if ssh "$TARGET_USER@$TARGET_SERVER" "sudo -n true" 2>/dev/null; then
+ echo " β
Sudo senza password configurato"
+else
+ echo " β οΈ Sudo richiede password (normale per sicurezza)"
+fi
+
+# Test dipendenze base
+echo ""
+echo "π¦ Test 4: Dipendenze presenti..."
+ssh "$TARGET_USER@$TARGET_SERVER" << 'EOF'
+echo -n " Git: "
+if command -v git &> /dev/null; then
+ echo "β
$(git --version | cut -d' ' -f3)"
+else
+ echo "β Non installato"
+fi
+
+echo -n " Curl: "
+if command -v curl &> /dev/null; then
+ echo "β
Presente"
+else
+ echo "β Non installato"
+fi
+
+echo -n " Docker: "
+if command -v docker &> /dev/null; then
+ echo "β
$(docker --version | cut -d' ' -f3 | tr -d ',')"
+else
+ echo "β Non installato"
+fi
+
+echo -n " Apache: "
+if command -v apache2 &> /dev/null; then
+ echo "β
$(apache2 -v | head -1 | cut -d' ' -f3)"
+else
+ echo "β Non installato"
+fi
+
+echo -n " PHP: "
+if command -v php &> /dev/null; then
+ echo "β
$(php --version | head -1 | cut -d' ' -f2)"
+else
+ echo "β Non installato"
+fi
+EOF
+
+# Test porte disponibili
+echo ""
+echo "π Test 5: Porte disponibili..."
+ssh "$TARGET_USER@$TARGET_SERVER" << 'EOF'
+echo " Porte in ascolto:"
+ss -tlnp | grep -E ":(80|3000|3306|22)" | while read line; do
+ port=$(echo $line | awk '{print $4}' | cut -d':' -f2)
+ echo " - Porta $port: occupata"
+done
+
+# Test porte libere importanti
+for port in 80 3000 3306; do
+ if ! ss -tln | grep -q ":$port "; then
+ echo " - Porta $port: β
libera"
+ fi
+done
+EOF
+
+echo ""
+echo "π === RIEPILOGO VERIFICA ==="
+echo "β
Connessione SSH verificata"
+echo "β
Sistema target accessibile"
+echo "β
Informazioni raccolte"
+echo ""
+
+echo "π Pronto per migrazione!"
+echo " Eseguire: ./docs/03-scripts-automazione/migrate-to-vm-master.sh"
+echo ""
diff --git a/docs/03-scripts-automazione/run-vm-setup.ps1 b/docs/03-scripts-automazione/run-vm-setup.ps1
new file mode 100644
index 00000000..1c5da3f3
--- /dev/null
+++ b/docs/03-scripts-automazione/run-vm-setup.ps1
@@ -0,0 +1,67 @@
+# π NETGESCON - ESEGUI SETUP VM MASTER
+# Script PowerShell per Windows - Esegue setup completo su VM Linux
+
+param(
+ [string]$VMUser = "michele",
+ [string]$VMHost = "192.168.0.200",
+ [switch]$SkipTransfer
+)
+
+Write-Host "π === NETGESCON - SETUP VM MASTER ===" -ForegroundColor Green
+Write-Host "π
$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" -ForegroundColor Gray
+Write-Host ""
+
+$ScriptPath = "u:\home\michele\netgescon\docs\03-scripts-automazione"
+$SetupScript = "$ScriptPath\setup-vm-master-nginx.sh"
+
+# Verifica che lo script esista
+if (-not (Test-Path $SetupScript)) {
+ Write-Host "β Script di setup non trovato: $SetupScript" -ForegroundColor Red
+ exit 1
+}
+
+Write-Host "π Configurazione:" -ForegroundColor Yellow
+Write-Host " VM Target: $VMUser@$VMHost"
+Write-Host " Script Setup: setup-vm-master-nginx.sh"
+Write-Host ""
+
+if (-not $SkipTransfer) {
+ # 1. Trasferisce lo script sulla VM
+ Write-Host "π€ 1. Trasferimento script sulla VM..." -ForegroundColor Cyan
+ $scpCmd = "scp `"$SetupScript`" $VMUser@${VMHost}:/home/michele/"
+ Write-Host " Comando: $scpCmd" -ForegroundColor Gray
+ Invoke-Expression $scpCmd
+ if ($LASTEXITCODE -ne 0) {
+ Write-Host "β Errore nel trasferimento file" -ForegroundColor Red
+ exit 1
+ }
+ Write-Host " β
Script trasferito" -ForegroundColor Green
+}
+
+# 2. Esegue lo script sulla VM
+Write-Host ""
+Write-Host "π§ 2. Esecuzione setup su VM..." -ForegroundColor Cyan
+Write-Host " ATTENZIONE: Lo script richiederΓ sudo password sulla VM" -ForegroundColor Yellow
+Write-Host ""
+
+# Comando SSH per eseguire il setup
+$sshCmd = "ssh $VMUser@$VMHost `"chmod +x setup-vm-master-nginx.sh && sudo ./setup-vm-master-nginx.sh`""
+Write-Host " Comando: $sshCmd" -ForegroundColor Gray
+Invoke-Expression $sshCmd
+
+if ($LASTEXITCODE -eq 0) {
+ Write-Host ""
+ Write-Host "π === SETUP COMPLETATO ===" -ForegroundColor Green
+ Write-Host "π NetGescon dovrebbe essere accessibile su: http://$VMHost" -ForegroundColor Cyan
+ Write-Host "π Gitea dovrebbe essere accessibile su: http://$VMHost:3000" -ForegroundColor Cyan
+ Write-Host ""
+ Write-Host "π Prossimi passi:" -ForegroundColor Yellow
+ Write-Host " 1. Testa accesso NetGescon: http://$VMHost"
+ Write-Host " 2. Configura Gitea: http://$VMHost:3000"
+ Write-Host " 3. Crea repository Git su Gitea"
+ Write-Host " 4. Push del progetto NetGescon"
+} else {
+ Write-Host ""
+ Write-Host "β Errore durante l'esecuzione del setup" -ForegroundColor Red
+ Write-Host " Controlla i log sulla VM per dettagli" -ForegroundColor Yellow
+}
diff --git a/docs/03-scripts-automazione/setup-vm-master-nginx.sh b/docs/03-scripts-automazione/setup-vm-master-nginx.sh
new file mode 100644
index 00000000..e34f68df
--- /dev/null
+++ b/docs/03-scripts-automazione/setup-vm-master-nginx.sh
@@ -0,0 +1,389 @@
+#!/bin/bash
+# π NETGESCON - SETUP CORRETTO VM MASTER CON NGINX
+# Creato: 19/07/2025 - Setup definitivo Michele + AI
+
+set -e
+
+echo "π === NETGESCON - SETUP DEFINITIVO VM MASTER ==="
+echo "π
$(date '+%Y-%m-%d %H:%M:%S')"
+echo ""
+
+# === CONFIGURAZIONI ===
+PROJECT_PATH="/home/michele/netgescon"
+WEB_ROOT="/var/www"
+DOMAIN="netgescon.local"
+VM_IP="192.168.0.200"
+
+echo "π Configurazione:"
+echo " Progetto: $PROJECT_PATH"
+echo " Web Server: Nginx (invece di Apache)"
+echo " Dominio: $DOMAIN"
+echo " IP VM: $VM_IP"
+echo ""
+
+# === 1. PULIZIA INIZIALE ===
+echo "π§Ή 1. Pulizia /var/www/ e rimozione Apache..."
+
+# Rimuove Apache se presente
+if systemctl is-active apache2 >/dev/null 2>&1; then
+ sudo systemctl stop apache2
+ sudo systemctl disable apache2
+ sudo apt remove -y apache2
+ echo " β
Apache rimosso"
+fi
+
+# Pulizia /var/www/
+sudo rm -rf /var/www/html
+sudo rm -rf /var/www/netgescon*
+sudo mkdir -p /var/www
+echo " β
Directory /var/www/ pulita"
+
+# === 2. AGGIORNAMENTO SISTEMA ===
+echo ""
+echo "π 2. Aggiornamento sistema..."
+sudo apt update && sudo apt upgrade -y
+
+# === 3. INSTALLAZIONE STACK NGINX ===
+echo ""
+echo "π¦ 3. Installazione stack con Nginx..."
+
+# Nginx
+sudo apt install -y nginx
+sudo systemctl enable nginx
+sudo systemctl start nginx
+
+# MySQL
+sudo apt install -y mysql-server
+sudo systemctl enable mysql
+sudo systemctl start mysql
+
+# PHP-FPM (migliore per Nginx)
+sudo apt install -y php8.1-fpm php8.1-mysql php8.1-xml php8.1-mbstring \
+ php8.1-zip php8.1-gd php8.1-curl php8.1-dom php8.1-common php8.1-cli \
+ php8.1-bcmath php8.1-opcache
+
+# Composer
+if ! command -v composer &> /dev/null; then
+ curl -sS https://getcomposer.org/installer | php
+ sudo mv composer.phar /usr/local/bin/composer
+ sudo chmod +x /usr/local/bin/composer
+fi
+
+# Node.js
+if ! command -v node &> /dev/null; then
+ curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
+ sudo apt install -y nodejs
+fi
+
+# Git (se non presente)
+sudo apt install -y git curl wget rsync
+
+echo " β
Stack Nginx installato"
+
+# === 4. CONFIGURAZIONE NGINX PER LARAVEL ===
+echo ""
+echo "π 4. Configurazione Nginx per Laravel..."
+
+# Backup configurazione default
+sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default.backup
+
+# Crea configurazione NetGescon ottimizzata
+sudo tee /etc/nginx/sites-available/netgescon << EOF
+server {
+ listen 80;
+ listen [::]:80;
+
+ server_name $DOMAIN $VM_IP localhost;
+ root $PROJECT_PATH/netgescon-laravel/public;
+ index index.php index.html index.htm;
+
+ # Logs
+ access_log /var/log/nginx/netgescon-access.log;
+ error_log /var/log/nginx/netgescon-error.log;
+
+ # Security headers
+ add_header X-Frame-Options "SAMEORIGIN" always;
+ add_header X-XSS-Protection "1; mode=block" always;
+ add_header X-Content-Type-Options "nosniff" always;
+ add_header Referrer-Policy "no-referrer-when-downgrade" always;
+ add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline'" always;
+
+ # Laravel routes
+ location / {
+ try_files \$uri \$uri/ /index.php?\$query_string;
+ }
+
+ # PHP-FPM
+ location ~ \.php$ {
+ include snippets/fastcgi-php.conf;
+ fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
+ fastcgi_param SCRIPT_FILENAME \$realpath_root\$fastcgi_script_name;
+ include fastcgi_params;
+
+ # Timeout ottimizzati per Laravel
+ fastcgi_read_timeout 300;
+ fastcgi_connect_timeout 300;
+ fastcgi_send_timeout 300;
+ }
+
+ # Static files caching
+ location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
+ expires 1y;
+ add_header Cache-Control "public, immutable";
+ try_files \$uri =404;
+ }
+
+ # Deny access to sensitive files
+ location ~ /\.(?!well-known).* {
+ deny all;
+ }
+
+ location ~ /\.env {
+ deny all;
+ }
+
+ # Prevent access to Laravel directories
+ location ~ ^/(storage|bootstrap/cache)/ {
+ deny all;
+ }
+}
+EOF
+
+# Abilita sito e disabilita default
+sudo ln -sf /etc/nginx/sites-available/netgescon /etc/nginx/sites-enabled/
+sudo rm -f /etc/nginx/sites-enabled/default
+
+# Test configurazione
+sudo nginx -t
+sudo systemctl reload nginx
+
+echo " β
Nginx configurato per Laravel"
+
+# === 5. CONFIGURAZIONE DATABASE ===
+echo ""
+echo "ποΈ 5. Configurazione database MySQL..."
+
+sudo mysql << 'MYSQL_SCRIPT'
+CREATE DATABASE IF NOT EXISTS netgescon;
+CREATE USER IF NOT EXISTS 'netgescon'@'localhost' IDENTIFIED BY 'netgescon2025';
+GRANT ALL PRIVILEGES ON netgescon.* TO 'netgescon'@'localhost';
+FLUSH PRIVILEGES;
+MYSQL_SCRIPT
+
+echo " β
Database MySQL configurato"
+
+# === 6. CONFIGURAZIONE LARAVEL ===
+echo ""
+echo "π§ 6. Configurazione Laravel..."
+
+cd $PROJECT_PATH/netgescon-laravel
+
+# Installa dipendenze se composer.json esiste
+if [ -f "composer.json" ]; then
+ composer install --no-dev --optimize-autoloader
+ echo " β
Dipendenze Composer installate"
+fi
+
+# Configura .env per produzione
+if [ ! -f ".env" ] && [ -f ".env.example" ]; then
+ cp .env.example .env
+fi
+
+# Aggiorna configurazione .env
+cat > .env << 'ENV_CONFIG'
+APP_NAME="NetGescon Master"
+APP_ENV=production
+APP_KEY=
+APP_DEBUG=false
+APP_URL=http://192.168.0.200
+
+LOG_CHANNEL=stack
+LOG_DEPRECATIONS_CHANNEL=null
+LOG_LEVEL=error
+
+DB_CONNECTION=mysql
+DB_HOST=127.0.0.1
+DB_PORT=3306
+DB_DATABASE=netgescon
+DB_USERNAME=netgescon
+DB_PASSWORD=netgescon2025
+
+BROADCAST_DRIVER=log
+CACHE_DRIVER=file
+FILESYSTEM_DISK=local
+QUEUE_CONNECTION=sync
+SESSION_DRIVER=file
+SESSION_LIFETIME=120
+
+MEMCACHED_HOST=127.0.0.1
+
+REDIS_HOST=127.0.0.1
+REDIS_PASSWORD=null
+REDIS_PORT=6379
+
+MAIL_MAILER=smtp
+MAIL_HOST=mailpit
+MAIL_PORT=1025
+MAIL_USERNAME=null
+MAIL_PASSWORD=null
+MAIL_ENCRYPTION=null
+MAIL_FROM_ADDRESS="hello@example.com"
+MAIL_FROM_NAME="${APP_NAME}"
+
+AWS_ACCESS_KEY_ID=
+AWS_SECRET_ACCESS_KEY=
+AWS_DEFAULT_REGION=us-east-1
+AWS_BUCKET=
+AWS_USE_PATH_STYLE_ENDPOINT=false
+
+PUSHER_APP_ID=
+PUSHER_APP_KEY=
+PUSHER_APP_SECRET=
+PUSHER_HOST=
+PUSHER_PORT=443
+PUSHER_SCHEME=https
+PUSHER_APP_CLUSTER=mt1
+
+VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
+VITE_PUSHER_HOST="${PUSHER_HOST}"
+VITE_PUSHER_PORT="${PUSHER_PORT}"
+VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
+VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
+ENV_CONFIG
+
+# Genera chiave app
+php artisan key:generate --force
+
+# Ottimizza per produzione
+php artisan config:cache
+php artisan route:cache
+php artisan view:cache
+
+# Permessi corretti
+sudo chown -R www-data:www-data $PROJECT_PATH/netgescon-laravel/storage
+sudo chown -R www-data:www-data $PROJECT_PATH/netgescon-laravel/bootstrap/cache
+sudo chmod -R 775 $PROJECT_PATH/netgescon-laravel/storage
+sudo chmod -R 775 $PROJECT_PATH/netgescon-laravel/bootstrap/cache
+
+echo " β
Laravel configurato per produzione"
+
+# Esegui migrazioni
+if [ -f "artisan" ]; then
+ php artisan migrate --force
+ echo " β
Migrazioni database eseguite"
+fi
+
+# === 7. INSTALLAZIONE DOCKER E GITEA ===
+echo ""
+echo "π³ 7. Installazione Docker e Gitea..."
+
+# Installa Docker
+if ! command -v docker &> /dev/null; then
+ curl -fsSL https://get.docker.com -o get-docker.sh
+ sudo sh get-docker.sh
+ sudo systemctl enable docker
+ sudo systemctl start docker
+ sudo usermod -aG docker michele
+ rm get-docker.sh
+fi
+
+# Crea directory per Gitea
+sudo mkdir -p /var/lib/gitea
+sudo chown -R 1000:1000 /var/lib/gitea
+
+# Avvia Gitea
+sudo docker run -d \
+ --name=gitea \
+ --restart=unless-stopped \
+ -p 3000:3000 \
+ -p 2222:22 \
+ -v /var/lib/gitea:/data \
+ -e USER_UID=1000 \
+ -e USER_GID=1000 \
+ -e GITEA__database__DB_TYPE=sqlite3 \
+ -e GITEA__database__PATH=/data/gitea/gitea.db \
+ -e GITEA__server__DOMAIN=git.netgescon.local \
+ -e GITEA__server__SSH_DOMAIN=git.netgescon.local \
+ -e GITEA__server__ROOT_URL=http://$VM_IP:3000/ \
+ gitea/gitea:1.21.0
+
+echo " β
Gitea installato e avviato"
+
+# === 8. CONFIGURAZIONE FIREWALL ===
+echo ""
+echo "π₯ 8. Configurazione firewall..."
+
+sudo ufw allow ssh
+sudo ufw allow 80/tcp
+sudo ufw allow 3000/tcp
+sudo ufw allow 2222/tcp
+sudo ufw --force enable
+
+echo " β
Firewall configurato"
+
+# === 9. CONFIGURAZIONE GIT ===
+echo ""
+echo "π§ 9. Configurazione Git repository..."
+
+cd $PROJECT_PATH
+
+# Configura Git
+git config --global user.name "NetGescon VM Master"
+git config --global user.email "master@netgescon.local"
+
+# Se non Γ¨ un repository, inizializza
+if [ ! -d ".git" ]; then
+ git init
+ git add .
+ git commit -m "π NetGescon Master VM - Setup completo con Nginx
+
+π Configurazione definitiva:
+β
Nginx + PHP-FPM ottimizzato per Laravel
+β
MySQL database configurato
+β
Gitea server pronto
+β
Firewall e sicurezza
+β
Struttura progetto: $(du -sh . | cut -f1)
+
+π
$(date '+%Y-%m-%d %H:%M:%S')
+π― Sistema pronto per sviluppo enterprise"
+ echo " β
Repository Git inizializzato"
+fi
+
+# === 10. RIEPILOGO FINALE ===
+echo ""
+echo "π === RIEPILOGO SETUP VM MASTER ==="
+echo "β
Sistema aggiornato"
+echo "β
Nginx + PHP-FPM installato (performance ottimali)"
+echo "β
MySQL database configurato"
+echo "β
Laravel ottimizzato per produzione"
+echo "β
Gitea server operativo"
+echo "β
Firewall configurato"
+echo "β
Git repository pronto"
+echo ""
+
+echo "π === INFORMAZIONI ACCESSO ==="
+echo "π NetGescon: http://$VM_IP"
+echo "π’ Gitea: http://$VM_IP:3000"
+echo "π Progetto: $PROJECT_PATH"
+echo "πΎ Spazio occupato: $(du -sh $PROJECT_PATH | cut -f1)"
+echo "π½ Spazio disponibile: $(df -h / | tail -1 | awk '{print $4}')"
+echo ""
+
+echo "π === STATUS SERVIZI ==="
+echo "Nginx: $(systemctl is-active nginx)"
+echo "MySQL: $(systemctl is-active mysql)"
+echo "PHP-FPM: $(systemctl is-active php8.1-fpm)"
+echo "Docker: $(systemctl is-active docker)"
+echo "Gitea: $(docker ps --filter name=gitea --format "{{.Status}}" | head -1 || echo 'Starting...')"
+echo ""
+
+echo "π === PROSSIMI PASSI ==="
+echo "1. π Testare NetGescon: http://$VM_IP"
+echo "2. π’ Configurare Gitea: http://$VM_IP:3000"
+echo "3. π¦ Creare repository in Gitea"
+echo "4. π Push codice da locale a Gitea"
+echo "5. π Iniziare sviluppo su VM Linux nativa"
+echo ""
+
+echo "π― Setup VM Master completato con successo!"
+echo "π
$(date '+%Y-%m-%d %H:%M:%S')"
diff --git a/docs/03-scripts-automazione/setup-vm-post-transfer.sh b/docs/03-scripts-automazione/setup-vm-post-transfer.sh
new file mode 100644
index 00000000..0d3e2ba5
--- /dev/null
+++ b/docs/03-scripts-automazione/setup-vm-post-transfer.sh
@@ -0,0 +1,231 @@
+#!/bin/bash
+# π§ NETGESCON - CONFIGURAZIONE POST-TRASFERIMENTO VM
+# Creato: 19/07/2025 - Setup completo su VM target
+
+echo "π§ === NETGESCON - CONFIGURAZIONE VM POST-TRASFERIMENTO ==="
+echo "π
$(date '+%Y-%m-%d %H:%M:%S')"
+echo ""
+
+# Da eseguire SULLA VM 192.168.0.200 dopo il trasferimento
+
+# === 1. AGGIORNAMENTO SISTEMA ===
+echo "π 1. Aggiornamento sistema Ubuntu..."
+sudo apt update && sudo apt upgrade -y
+
+# === 2. INSTALLAZIONE STACK LAMP ===
+echo ""
+echo "π¦ 2. Installazione stack LAMP..."
+
+# Apache
+sudo apt install -y apache2
+sudo systemctl enable apache2
+sudo systemctl start apache2
+
+# MySQL
+sudo apt install -y mysql-server
+sudo systemctl enable mysql
+sudo systemctl start mysql
+
+# PHP 8.1
+sudo apt install -y php8.1 php8.1-mysql php8.1-xml php8.1-mbstring php8.1-zip php8.1-gd php8.1-curl php8.1-dom php8.1-common php8.1-cli
+
+# Composer
+curl -sS https://getcomposer.org/installer | php
+sudo mv composer.phar /usr/local/bin/composer
+sudo chmod +x /usr/local/bin/composer
+
+# Node.js
+curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
+sudo apt install -y nodejs
+
+echo " β
Stack LAMP installato"
+
+# === 3. CONFIGURAZIONE GIT ===
+echo ""
+echo "π§ 3. Configurazione Git..."
+
+cd /home/michele/netgescon
+
+# Configura Git globalmente
+git config --global user.name "NetGescon VM Master"
+git config --global user.email "master@netgescon.local"
+git config --global init.defaultBranch master
+
+# Inizializza repository se necessario
+if [ ! -d ".git" ]; then
+ git init
+ echo " π¦ Repository Git inizializzato"
+fi
+
+# Commit tutto
+git add .
+git commit -m "π NETGESCON - Primo commit su VM Master
+
+π Migrazione completa da Windows WSL
+π Primo setup su VM Linux 192.168.0.200
+π
$(date '+%Y-%m-%d %H:%M:%S')
+π― Repository master operativo"
+
+echo " β
Git configurato e commit iniziale creato"
+
+# === 4. CONFIGURAZIONE LARAVEL ===
+echo ""
+echo "π§ 4. Configurazione Laravel..."
+
+cd /home/michele/netgescon/netgescon-laravel
+
+# Installa dipendenze
+if [ -f "composer.json" ]; then
+ composer install --no-dev --optimize-autoloader
+ echo " β
Dipendenze Composer installate"
+fi
+
+# Configura .env
+if [ ! -f ".env" ] && [ -f ".env.example" ]; then
+ cp .env.example .env
+ php artisan key:generate
+ echo " β
File .env configurato"
+fi
+
+# Configura database in .env
+sed -i 's/DB_DATABASE=.*/DB_DATABASE=netgescon/' .env
+sed -i 's/DB_USERNAME=.*/DB_USERNAME=netgescon/' .env
+sed -i 's/DB_PASSWORD=.*/DB_PASSWORD=netgescon2025/' .env
+
+# Permessi
+sudo chown -R www-data:www-data storage bootstrap/cache
+sudo chmod -R 775 storage bootstrap/cache
+
+echo " β
Laravel configurato"
+
+# === 5. CONFIGURAZIONE DATABASE ===
+echo ""
+echo "ποΈ 5. Configurazione database MySQL..."
+
+# Configura MySQL
+sudo mysql << 'EOF'
+CREATE DATABASE IF NOT EXISTS netgescon;
+CREATE USER IF NOT EXISTS 'netgescon'@'localhost' IDENTIFIED BY 'netgescon2025';
+GRANT ALL PRIVILEGES ON netgescon.* TO 'netgescon'@'localhost';
+FLUSH PRIVILEGES;
+EXIT;
+EOF
+
+echo " β
Database MySQL configurato"
+
+# Esegui migrazioni
+cd /home/michele/netgescon/netgescon-laravel
+if [ -f "artisan" ]; then
+ php artisan migrate --force
+ echo " β
Migrazioni database eseguite"
+fi
+
+# === 6. CONFIGURAZIONE APACHE ===
+echo ""
+echo "π 6. Configurazione Apache VirtualHost..."
+
+# Crea VirtualHost
+sudo tee /etc/apache2/sites-available/netgescon.conf > /dev/null << 'EOF'
+
+ ServerName netgescon.local
+ ServerAlias 192.168.0.200
+ DocumentRoot /home/michele/netgescon/netgescon-laravel/public
+
+
+ AllowOverride All
+ Require all granted
+ DirectoryIndex index.php
+
+
+
+ AllowOverride None
+ Require all denied
+
+
+ ErrorLog ${APACHE_LOG_DIR}/netgescon_error.log
+ CustomLog ${APACHE_LOG_DIR}/netgescon_access.log combined
+
+EOF
+
+# Abilita moduli e sito
+sudo a2enmod rewrite
+sudo a2ensite netgescon
+sudo a2dissite 000-default
+sudo systemctl reload apache2
+
+echo " β
Apache VirtualHost configurato"
+
+# === 7. INSTALLAZIONE DOCKER PER GITEA ===
+echo ""
+echo "π³ 7. Installazione Docker per Gitea..."
+
+# Installa Docker
+curl -fsSL https://get.docker.com -o get-docker.sh
+sudo sh get-docker.sh
+sudo systemctl enable docker
+sudo systemctl start docker
+
+# Aggiunge utente al gruppo docker
+sudo usermod -aG docker michele
+
+echo " β
Docker installato"
+
+# === 8. SETUP GITEA ===
+echo ""
+echo "π’ 8. Setup Gitea (Git Server)..."
+
+# Crea directory
+sudo mkdir -p /var/lib/gitea
+
+# Avvia Gitea con Docker
+sudo docker run -d \
+ --name=gitea \
+ --restart=unless-stopped \
+ -p 3000:3000 \
+ -p 2222:22 \
+ -v /var/lib/gitea:/data \
+ -e USER_UID=1000 \
+ -e USER_GID=1000 \
+ gitea/gitea:1.21.0
+
+echo " β
Gitea avviato"
+
+# === 9. CONFIGURAZIONE FIREWALL ===
+echo ""
+echo "π₯ 9. Configurazione firewall UFW..."
+
+sudo ufw allow ssh
+sudo ufw allow 80/tcp
+sudo ufw allow 3000/tcp
+sudo ufw allow 2222/tcp
+sudo ufw --force enable
+
+echo " β
Firewall configurato"
+
+# === 10. TEST FINALE ===
+echo ""
+echo "π§ͺ 10. Test configurazione finale..."
+
+echo "π === STATUS SERVIZI ==="
+echo "Apache: $(sudo systemctl is-active apache2)"
+echo "MySQL: $(sudo systemctl is-active mysql)"
+echo "Docker: $(sudo systemctl is-active docker)"
+echo "Gitea: $(sudo docker ps --filter name=gitea --format "table {{.Status}}" | tail -1)"
+echo ""
+
+echo "π === INFORMAZIONI ACCESSO ==="
+echo "π NetGescon: http://192.168.0.200"
+echo "π’ Gitea: http://192.168.0.200:3000"
+echo "π Progetto: /home/michele/netgescon"
+echo ""
+
+echo "π === PROSSIMI PASSI ==="
+echo "1. π Aprire http://192.168.0.200:3000 per configurare Gitea"
+echo "2. π’ Creare organizzazione 'netgescon' in Gitea"
+echo "3. π¦ Creare repository 'netgescon-main' in Gitea"
+echo "4. π Configurare remote Git e push del codice"
+echo "5. π§ͺ Testare NetGescon su http://192.168.0.200"
+echo ""
+
+echo "π― Configurazione VM completata!"
+echo "π
$(date '+%Y-%m-%d %H:%M:%S')"