Stack LEMP (Linux + Nginx + MySQL + PHP)
Ce guide vous montrera comment installer WordPress sur un VPS Ubuntu 22.04 en utilisant le stack LEMP, la combinaison la plus rapide pour WordPress.
Étape 1 — Installer Nginx, MySQL et PHP
apt update && apt upgrade -y
apt install nginx mysql-server php8.2-fpm php8.2-mysql php8.2-xml php8.2-curl php8.2-mbstring php8.2-zip php8.2-gd -y
systemctl start nginx mysql php8.2-fpm
systemctl enable nginx mysql php8.2-fpm
apt install nginx mysql-server php8.2-fpm php8.2-mysql php8.2-xml php8.2-curl php8.2-mbstring php8.2-zip php8.2-gd -y
systemctl start nginx mysql php8.2-fpm
systemctl enable nginx mysql php8.2-fpm
Étape 2 — Créer une base de données MySQL
mysql -u root -p
CREATE DATABASE wordpress;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'VotreMotDePasseSécurisé';
GRANT ALL ON wordpress.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
CREATE DATABASE wordpress;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'VotreMotDePasseSécurisé';
GRANT ALL ON wordpress.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Étape 3 — Télécharger et installer WordPress
cd /var/www
wget https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz
mv wordpress votredomaine
chown -R www-data:www-data votredomaine
chmod -R 755 votredomaine
wget https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz
mv wordpress votredomaine
chown -R www-data:www-data votredomaine
chmod -R 755 votredomaine
Étape 4 — Configurer Nginx pour WordPress
Créez le fichier /etc/nginx/conf.d/votredomaine.conf :
server {
listen 80;
server_name votredomaine.com;
root /var/www/votredomaine;
index index.php;
location / { try_files $uri $uri/ /index.php?$args; }
location ~ \.php$ {
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
listen 80;
server_name votredomaine.com;
root /var/www/votredomaine;
index index.php;
location / { try_files $uri $uri/ /index.php?$args; }
location ~ \.php$ {
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Ensuite : nginx -t && systemctl reload nginx
Étape 5 — Finaliser l'installation depuis le navigateur
Rendez-vous sur http://votredomaine.com et suivez l'assistant d'installation de WordPress en utilisant les informations de la base de données de l'Étape 2.
✅ WordPress installé. Accédez au panneau d'administration via
votredomaine.com/wp-admin. Pour ajouter le HTTPS, installez Certbot : apt install certbot python3-certbot-nginx -y && certbot --nginx -d votredomaine.com