Hoe stel je een webserver in op je VPS
Getest op Ubuntu/Debian/CentOS
Vereisten
-
Een VPS met root/SSH-toegang
-
Basiskennis van de Linux-opdrachtregel
-
10-15 minuten tijd
1️⃣ Werk je systeem bij
# Voor Ubuntu/Debian: sudo apt update && sudo apt upgrade -y # Voor CentOS/RHEL: sudo yum update -y
2️⃣ Installeer een webserver
Optie A: Apache (Eenvoudig en universeel)
# Ubuntu/Debian: sudo apt install apache2 -y # CentOS: sudo yum install httpd -y
Start en activeer:
sudo systemctl start apache2 # of httpd (CentOS) sudo systemctl enable apache2
✅ Controleer: Bezoek het IP-adres van je server in een browser. Je zou de Apache-testpagina moeten zien.
Optie B: Nginx (Snel en lichtgewicht)
sudo apt install nginx -y # Ubuntu/Debian sudo yum install nginx -y # CentOS
Start en activeer:
sudo systemctl start nginx sudo systemctl enable nginx
✅ Controleer: Bezoek http://[je-server-IP]
voor de Nginx-welkompagina.
3️⃣ Installeer MySQL/MariaDB (Database)
# Ubuntu/Debian: sudo apt install mariadb-server -y # CentOS: sudo yum install mariadb-server -y
Veilige installatie:
sudo mysql_secure_installation
(Volg de aanwijzingen om het root-wachtwoord in te stellen en onveilige standaardinstellingen te verwijderen)
4️⃣ Installeer PHP (Voor dynamische inhoud)
# Ubuntu/Debian: sudo apt install php php-mysql -y # CentOS: sudo yum install php php-mysql -y
Test PHP:
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php
✅ Bezoek http://[je-server-IP]/info.php
om PHP-gegevens te zien.
5️⃣ Configureer firewall
Sta HTTP/HTTPS-verkeer toe:
# 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️⃣ Automatisch starten van services
Zorg dat services bij het herstarten automatisch starten:
# Voor Apache: sudo systemctl enable apache2 # of httpd # Voor Nginx: sudo systemctl enable nginx # Voor MariaDB: sudo systemctl enable mariadb
Volgende stappen
-
Upload je website via SFTP/FTP
-
Beveilig met SSL (Gebruik Let’s Encrypt):
sudo apt install certbot -y sudo certbot --apache # of --nginx
-
Optimaliseer prestaties (Activeer caching, gebruik PHP-FPM)
Professionele tips
-
Heb je een controlepaneel nodig? Probeer:
-
Webmin (Gratis)
-
CyberPanel (Voor OpenLiteSpeed)
-
-
Docker-optie? Draai Nginx/PHP in containers voor isolatie.
Voorbeeld LAMP Stack in één commando (Ubuntu):
sudo apt update && sudo apt install apache2 mariadb-server php php-mysql -y && sudo mysql_secure_installation
Klaar!
Je hebt nu een zelfgehoste webserver! Heb je hulp nodig? Neem contact op met AuxoDomain Support.