================================================================================ HANDMATIGE COMMANDO'S - STAP VOOR STAP Voor test.baro-edegem.com op Ubuntu 24.04 (Hetzner) ================================================================================ OPTIE A: Volautomatisch (aanbevolen) ------------------------------------- 1. Upload alle scripts naar je server 2. Maak ze executable: chmod +x test-baro-setup.sh test-baro-https.sh troubleshooting.sh 3. Run ze: ./test-baro-setup.sh ./test-baro-https.sh OPTIE B: Handmatig blok per blok (copy-paste klaar) ---------------------------------------------------- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BLOK 1: Map aanmaken + permissions Reden: Directory structuur klaarzetten met juiste rechten ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ sudo mkdir -p /var/www/testbaro sudo chown -R baro:baro /var/www/testbaro sudo chmod 755 /var/www/testbaro ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BLOK 2: Test HTML aanmaken Reden: Direct zichtbaar resultaat om te verifiëren dat alles werkt ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ cat > /var/www/testbaro/index.html <<'EOF' Test Baro Edegem - Werkt!

🚀 Test Subdomain Actief!

✓ test.baro-edegem.com draait succesvol

Server: Ubuntu 24.04 (Hetzner)

IP: 5.75.159.94

User: baro

EOF chmod 644 /var/www/testbaro/index.html ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BLOK 3A: Nginx config (voor sites-available/sites-enabled structuur) Reden: Standaard Ubuntu/Debian manier, schoon gescheiden configs ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ sudo tee /etc/nginx/sites-available/test.baro-edegem.com > /dev/null <<'EOF' # Test subdomain: test.baro-edegem.com # Aangemaakt: 2025-12-29 # NIET VERWIJDEREN: Dit is een test site naast zaiko.baro-edegem.com server { listen 80; listen [::]:80; server_name test.baro-edegem.com; root /var/www/testbaro; index index.html index.htm; # Access en error logs access_log /var/log/nginx/test.baro-edegem.com.access.log; error_log /var/log/nginx/test.baro-edegem.com.error.log; # Try files location / { try_files $uri $uri/ =404; } # Security headers add_header X-Frame-Options "SAMEORIGIN" always; add_header X-Content-Type-Options "nosniff" always; add_header X-XSS-Protection "1; mode=block" always; # Disable .ht access location ~ /\.ht { deny all; } } EOF sudo ln -s /etc/nginx/sites-available/test.baro-edegem.com /etc/nginx/sites-enabled/ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BLOK 3B: Nginx config (voor conf.d structuur - ALTERNATIEF) Reden: Als sites-available niet bestaat, gebruik conf.d Gebruik ALLEEN als 3A niet werkt! ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ sudo tee /etc/nginx/conf.d/test.baro-edegem.com.conf > /dev/null <<'EOF' # Test subdomain: test.baro-edegem.com # Aangemaakt: 2025-12-29 # NIET VERWIJDEREN: Dit is een test site naast zaiko.baro-edegem.com server { listen 80; listen [::]:80; server_name test.baro-edegem.com; root /var/www/testbaro; index index.html index.htm; # Access en error logs access_log /var/log/nginx/test.baro-edegem.com.access.log; error_log /var/log/nginx/test.baro-edegem.com.error.log; # Try files location / { try_files $uri $uri/ =404; } # Security headers add_header X-Frame-Options "SAMEORIGIN" always; add_header X-Content-Type-Options "nosniff" always; add_header X-XSS-Protection "1; mode=block" always; # Disable .ht access location ~ /\.ht { deny all; } } EOF ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BLOK 4: Nginx test en reload Reden: Config controleren VOOR activatie (veiligheid), reload i.p.v. restart ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ sudo nginx -t sudo systemctl reload nginx ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BLOK 5: DNS verificatie Reden: Checken of DNS naar juiste IP wijst (5.75.159.94) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ dig +short test.baro-edegem.com ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BLOK 6: HTTP test Reden: Verifiëren dat Nginx reageert en correcte headers stuurt ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ curl -I http://test.baro-edegem.com ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BLOK 7: Firewall check en openen (indien UFW actief) Reden: Ports 80 en 443 toegankelijk maken voor HTTP/HTTPS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ sudo ufw status sudo ufw allow 80/tcp sudo ufw allow 443/tcp ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BLOK 8: Certbot installatie Reden: Let's Encrypt SSL certificaat tools ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ sudo apt update sudo apt install -y certbot python3-certbot-nginx ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BLOK 9: SSL certificaat aanvragen Reden: HTTPS activeren met gratis Let's Encrypt cert, auto-configuratie ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ sudo certbot --nginx -d test.baro-edegem.com --non-interactive --agree-tos --register-unsafely-without-email --redirect ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BLOK 10: HTTPS test Reden: Verifiëren dat SSL werkt en redirect correct is ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ curl -Ik https://test.baro-edegem.com ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ TROUBLESHOOTING COMMANDO'S (bij problemen) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ # Nginx config testen sudo nginx -t # Nginx logs live volgen sudo tail -f /var/log/nginx/test.baro-edegem.com.access.log sudo tail -f /var/log/nginx/test.baro-edegem.com.error.log sudo tail -f /var/log/nginx/error.log # Laatste 20 error logs sudo tail -n 20 /var/log/nginx/test.baro-edegem.com.error.log # Nginx status sudo systemctl status nginx # Nginx herstart (als reload niet werkt) sudo systemctl restart nginx # DNS check met details dig test.baro-edegem.com # Port check sudo netstat -tlnp | grep -E ':80|:443' # Alle nginx configs checken sudo nginx -T | grep -A 20 "test.baro-edegem.com" # Certificaat info sudo certbot certificates # Test vanaf localhost (op de server zelf) curl -v http://localhost -H "Host: test.baro-edegem.com" # Permissions check ls -la /var/www/testbaro/ # Zaiko check (moet blijven werken!) curl -I http://zaiko.baro-edegem.com ================================================================================ VEILIGHEIDS CHECKS ================================================================================ 1. Zaiko blijft werken: curl -I http://zaiko.baro-edegem.com 2. Geen conflicten in nginx: sudo nginx -T | grep "server_name" 3. Log files zijn aanwezig: ls -la /var/log/nginx/ | grep test.baro-edegem.com ================================================================================ QUICK REFERENCE ================================================================================ HTTP test: http://test.baro-edegem.com HTTPS test: https://test.baro-edegem.com Root dir: /var/www/testbaro Config: /etc/nginx/sites-available/test.baro-edegem.com Access log: /var/log/nginx/test.baro-edegem.com.access.log Error log: /var/log/nginx/test.baro-edegem.com.error.log ================================================================================