Wie man einen Webserver auf deinem VPS einrichtet
Getestet auf Ubuntu/Debian/CentOS
Voraussetzungen
-
Ein VPS mit Root-/SSH-Zugang
-
Grundlegende Kenntnisse der Linux-Kommandozeile
-
10-15 Minuten Zeit
1️⃣ Aktualisiere dein System
# Für Ubuntu/Debian: sudo apt update && sudo apt upgrade -y # Für CentOS/RHEL: sudo yum update -y
2️⃣ Installiere einen Webserver
Option A: Apache (Einfach & Universell)
# Ubuntu/Debian: sudo apt install apache2 -y # CentOS: sudo yum install httpd -y
Starten und aktivieren:
sudo systemctl start apache2 # oder httpd (CentOS) sudo systemctl enable apache2
✅ Überprüfe: Öffne die IP deines Servers im Browser. Du solltest die Apache-Testseite sehen.
Option B: Nginx (Schnell & Leicht)
sudo apt install nginx -y # Ubuntu/Debian sudo yum install nginx -y # CentOS
Starten und aktivieren:
sudo systemctl start nginx sudo systemctl enable nginx
✅ Überprüfe: Besuche http://[deine-server-ip]
für die Nginx-Willkommensseite.
3️⃣ Installiere MySQL/MariaDB (Datenbank)
# Ubuntu/Debian: sudo apt install mariadb-server -y # CentOS: sudo yum install mariadb-server -y
Sichere Installation:
sudo mysql_secure_installation
(Folge den Anweisungen, um ein Root-Passwort zu setzen und unsichere Standardeinstellungen zu entfernen)
4️⃣ Installiere PHP (Für dynamische Inhalte)
# Ubuntu/Debian: sudo apt install php php-mysql -y # CentOS: sudo yum install php php-mysql -y
Teste PHP:
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php
✅ Besuche http://[deine-server-ip]/info.php
, um PHP-Informationen zu sehen.
5️⃣ Konfiguriere die Firewall
Erlaube HTTP/HTTPS-Verkehr:
# Ubuntu/Debian (UFW): sudo ufw allow 80/tcp sudo ufw allow 443/tcp # CentOS (FirewallD): sudo firewall-cmd --permanent --add-service=http sudo firewall-cmd --permanent --add-service=https sudo firewall-cmd --reload
6️⃣ Automatischer Dienststart
Stelle sicher, dass die Dienste beim Neustart automatisch starten:
# Für Apache: sudo systemctl enable apache2 # oder httpd # Für Nginx: sudo systemctl enable nginx # Für MariaDB: sudo systemctl enable mariadb
Nächste Schritte
-
Lade deine Webseite hoch via SFTP/FTP
-
Sichere mit SSL (Benutze Let’s Encrypt):
sudo apt install certbot -y sudo certbot --apache # oder --nginx
-
Optimiere die Leistung (Aktiviere Caching, nutze PHP-FPM)
Profi-Tipps
-
Benötigst du ein Control Panel? Probiere:
-
Webmin (Kostenlos)
-
CyberPanel (Für OpenLiteSpeed)
-
-
Docker-Option? Führe Nginx/PHP in Containern zur Isolation aus.
Beispiel für LAMP Stack in einem Befehl (Ubuntu):
sudo apt update && sudo apt install apache2 mariadb-server php php-mysql -y && sudo mysql_secure_installation
Fertig!
Du hast jetzt einen selbst gehosteten Webserver! Brauchst du Hilfe? Kontaktiere den AuxoDomain Support.