Update Apache configuration to include fallback for SPA routes and add start script in package.json for Nuxt server.

This commit is contained in:
Torsten Schulz (local)
2025-10-21 01:05:11 +02:00
parent 87c71b1382
commit f33990cf46
3 changed files with 36 additions and 1 deletions

View File

@@ -25,11 +25,15 @@
RewriteRule . /index.html [L]
</Directory>
# 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
# RewriteCond %{SERVER_NAME} =harheimertc.tsschulz.de

30
deploy.sh Normal file
View File

@@ -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/"

View File

@@ -9,6 +9,7 @@
"build": "nuxt build",
"generate": "nuxt generate",
"preview": "nuxt preview --port 3100",
"start": "nuxt start --port 3100",
"postinstall": "nuxt prepare"
},
"dependencies": {