This commit is contained in:
sasha-astiadi 2025-08-20 02:11:07 +02:00
parent 1d5879619f
commit 8cfe8a0dbe
5 changed files with 118 additions and 3 deletions

37
Caddyfile Normal file
View File

@ -0,0 +1,37 @@
www2.veda-egypt.com {
root * /var/www/veda/out
# Handle subdirectories properly - try directory/index.html first
@dirs {
file {
try_files {path} {path}/ {path}/index.html
}
}
rewrite @dirs {http.matchers.file.relative}
# Fallback for SPA routing
try_files {path} {path}/index.html /index.html
file_server
# Add headers for better caching
header {
# Cache static assets
Cache-Control "public, max-age=31536000" {
path /_next/static/*
}
Cache-Control "public, max-age=3600" {
path *.css
path *.js
path *.png
path *.jpg
path *.jpeg
path *.gif
path *.svg
path *.webp
}
}
# Compress responses
encode gzip
}

78
deploy.sh Executable file
View File

@ -0,0 +1,78 @@
#!/bin/bash
# VEDA Static Site Deployment Script
# This script will deploy your Next.js static site to the production server
echo "🚀 VEDA Static Site Deployment"
echo "================================"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Check if out directory exists
if [ ! -d "out" ]; then
echo -e "${RED}❌ Error: 'out' directory not found. Run 'npm run build' first.${NC}"
exit 1
fi
echo -e "${GREEN}✅ Found 'out' directory with static files${NC}"
echo ""
echo "📋 DEPLOYMENT INSTRUCTIONS:"
echo "==========================="
echo ""
echo -e "${YELLOW}1. Copy these files to your server:${NC}"
echo " - Upload the 'out' directory"
echo " - Upload the 'Caddyfile'"
echo ""
echo -e "${YELLOW}2. Run these commands on your server:${NC}"
echo ""
cat << 'EOF'
# Create the web directory if it doesn't exist
sudo mkdir -p /var/www/veda
# Copy the static files (adjust path as needed)
sudo cp -r out/* /var/www/veda/out/ 2>/dev/null || {
sudo mkdir -p /var/www/veda/out
sudo cp -r out/* /var/www/veda/out/
}
# Set proper permissions
sudo chown -R www-data:www-data /var/www/veda/ 2>/dev/null || sudo chown -R caddy:caddy /var/www/veda/
# Backup current Caddyfile
sudo cp /etc/caddy/Caddyfile /etc/caddy/Caddyfile.backup.$(date +%Y%m%d_%H%M%S) 2>/dev/null
# Update Caddyfile (adjust path if different)
sudo cp Caddyfile /etc/caddy/Caddyfile
# Test Caddy configuration
sudo caddy validate --config /etc/caddy/Caddyfile
# Reload Caddy
sudo systemctl reload caddy
# Check Caddy status
sudo systemctl status caddy
EOF
echo ""
echo -e "${YELLOW}3. Test your deployment:${NC}"
echo " https://www2.veda-egypt.com/"
echo " https://www2.veda-egypt.com/story/"
echo " https://www2.veda-egypt.com/dahabiyas/"
echo " https://www2.veda-egypt.com/experiences/"
echo ""
echo -e "${GREEN}📁 Files ready for deployment:${NC}"
ls -la out/ | head -10
echo " ... and more"
echo ""
echo -e "${GREEN}✅ All files prepared! Copy the commands above and run them on your server.${NC}"

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long