From f33990cf460446effd7fcf04c1b2411d1d136e54 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Tue, 21 Oct 2025 01:05:11 +0200 Subject: [PATCH] Update Apache configuration to include fallback for SPA routes and add start script in package.json for Nuxt server. --- apache-config.conf | 6 +++++- deploy.sh | 30 ++++++++++++++++++++++++++++++ package.json | 1 + 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 deploy.sh diff --git a/apache-config.conf b/apache-config.conf index 04f5503..b0daebb 100644 --- a/apache-config.conf +++ b/apache-config.conf @@ -25,10 +25,14 @@ RewriteRule . /index.html [L] - # API-Routes für Nuxt Server (falls Server-Side Rendering verwendet wird) + # API-Routes für Nuxt Server ProxyPreserveHost On ProxyPass /api/ http://localhost:3100/api/ ProxyPassReverse /api/ http://localhost:3100/api/ + + # Fallback für alle anderen Routen (SPA) + ProxyPass / http://localhost:3100/ + ProxyPassReverse / http://localhost:3100/ # Redirect zu HTTPS (optional - kann später aktiviert werden) # RewriteEngine On diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 0000000..8651293 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# deploy.sh - Deployment-Skript für Harheimer TC + +echo "🚀 Starting Harheimer TC Deployment..." + +# Repository aktualisieren +echo "📥 Updating repository..." +cd /var/www/harheimertc +git pull origin main + +# Dependencies installieren +echo "📦 Installing dependencies..." +npm install + +# Website bauen (Static Generation) +echo "🔨 Building website..." +npm run generate + +# Berechtigungen setzen +echo "🔐 Setting permissions..." +sudo chown -R www-data:www-data /var/www/harheimertc/dist/ +sudo chmod -R 755 /var/www/harheimertc/dist/ + +# PM2 Backend starten (falls nicht läuft) +echo "🖥️ Starting backend server..." +pm2 start ecosystem.config.cjs || pm2 restart harheimertc + +echo "✅ Deployment completed!" +echo "🌐 Website: https://harheimertc.tsschulz.de" +echo "🔧 Backend: https://harheimertc.tsschulz.de/api/" diff --git a/package.json b/package.json index 6f98416..86041e6 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "build": "nuxt build", "generate": "nuxt generate", "preview": "nuxt preview --port 3100", + "start": "nuxt start --port 3100", "postinstall": "nuxt prepare" }, "dependencies": {