Het installeren van Craft CMS op je VPS-server die draait op Debian 12 is een eenvoudig proces. Volg de onderstaande stappen om het in te stellen.
Stap 1: Update je Systeem
sudo apt update && sudo apt upgrade -y
Stap 2: Installeer Vereiste Afhankelijkheden
Installeer de benodigde pakketten zoals PHP, MySQL en Composer:
sudo apt install nginx mysql-server php php-fpm php-mysql php-xml php-mbstring php-curl php-zip php-gd -y
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
Stap 3: Stel MySQL Database in
Log in op MySQL om een database en gebruiker voor Craft CMS aan te maken:
sudo mysql -u root -p
Voer in de MySQL-shell de volgende commando’s uit:
CREATE DATABASE craft;
CREATE USER 'craftuser'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON craft.* TO 'craftuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Stap 4: Download Craft CMS
Ga naar de webroot en download Craft CMS:
cd /var/www/html
composer create-project craftcms/craft craft
Stap 5: Configureer Nginx
Maak een nieuwe configuratiebestand voor Craft CMS:
sudo nano /etc/nginx/sites-available/craft
Voeg de volgende configuratie toe:
server {
listen 80;
server_name your_domain.com; # Wijzig dit naar jouw domein
root /var/www/html/craft/web;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; # Pas PHP-versie aan indien nodig
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Activeer de nieuwe site en test de configuratie:
sudo ln -s /etc/nginx/sites-available/craft /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
Stap 6: Voltooi de Installatie van Craft CMS
Open je webbrowser en ga naar http://your_domain.com. Volg de instructies op het scherm om de installatie te voltooien en voer de database-informatie in wanneer je daarom gevraagd wordt.
Conclusie
Door deze stappen te volgen, heb je Craft CMS met succes geïnstalleerd op je VPS-server. Je kunt nu beginnen met het bouwen van je website!