Credit : Illustration backtotheweb.fr
Installer et configurer PrestaShop sur un VPS IONOS
Installer et configurer PrestaShop sur un VPS IONOS
PrestaShop est la solution e-commerce open source la plus populaire en France. Ce guide couvre l'installation complete de PrestaShop 8 sur un VPS IONOS avec une stack performante.
Prerequis
- Un VPS IONOS sous Debian 12 (minimum 2 Go de RAM)
- Un nom de domaine pointe vers le serveur
- Un acces SSH root
1. Installer la stack LEMP
apt update && apt upgrade -y
apt install nginx mariadb-server -y
apt install php8.2-fpm php8.2-mysql php8.2-curl php8.2-gd php8.2-intl php8.2-mbstring php8.2-xml php8.2-zip php8.2-bcmath php8.2-memcached -y
2. Configurer PHP pour PrestaShop
PrestaShop a des exigences specifiques. Editez /etc/php/8.2/fpm/php.ini :
memory_limit = 512M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
max_input_vars = 10000
allow_url_fopen = On
Redemarrez PHP-FPM :
systemctl restart php8.2-fpm
3. Creer la base de donnees
mysql_secure_installation
mysql -u root -p
CREATE DATABASE prestashop CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'ps_user'@'localhost' IDENTIFIED BY 'MotDePasse_Securise!';
GRANT ALL PRIVILEGES ON prestashop.* TO 'ps_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
4. Telecharger PrestaShop
cd /var/www
mkdir maboutique.fr
cd maboutique.fr
wget https://github.com/PrestaShop/PrestaShop/releases/download/8.1.0/prestashop_8.1.0.zip
apt install unzip -y
unzip prestashop_8.1.0.zip
unzip prestashop.zip
rm prestashop_8.1.0.zip prestashop.zip
chown -R www-data:www-data /var/www/maboutique.fr
5. Configurer le vhost Nginx
Creez /etc/nginx/sites-available/maboutique.fr :
server {
listen 80;
server_name maboutique.fr www.maboutique.fr;
root /var/www/maboutique.fr;
index index.php;
client_max_body_size 64M;
# Rewrite rules pour PrestaShop
location / {
try_files $uri $uri/ /index.php?$args;
}
# Images et assets statiques
location ~* \.(jpg|jpeg|gif|png|css|js|ico|svg|woff2|webp)$ {
expires 30d;
access_log off;
}
# PHP-FPM
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_read_timeout 300;
}
# Bloquer l'acces aux fichiers sensibles
location ~ /\. {
deny all;
}
> **Astuce** : j'ai appris ça à la dure après un incident en prod un vendredi soir.
location ~* \.(tpl|log|conf)$ {
deny all;
}
}
ln -s /etc/nginx/sites-available/maboutique.fr /etc/nginx/sites-enabled/
nginx -t
systemctl reload nginx
6. Installer le certificat SSL
apt install certbot python3-certbot-nginx -y
certbot --nginx -d maboutique.fr -d www.maboutique.fr
7. Installation en ligne de commande
PrestaShop supporte l'installation CLI, pratique sur un serveur :
cd /var/www/maboutique.fr
php install-dev/index_cli.php \
--domain=maboutique.fr \
--db_server=localhost \
--db_name=prestashop \
--db_user=ps_user \
--db_password='MotDePasse_Securise!' \
--prefix=ps_ \
--email=admin@maboutique.fr \
--password='AdminSecure123!' \
--name='Ma Boutique' \
--language=fr \
--country=fr \
--ssl=1
8. Post-installation
Supprimez le dossier d'installation (obligatoire) :
rm -rf /var/www/maboutique.fr/install
Renommez le dossier d'administration pour la securite :
mv /var/www/maboutique.fr/admin /var/www/maboutique.fr/admin-secret-xyz
Corrigez les permissions :
find /var/www/maboutique.fr -type d -exec chmod 755 {} \;
find /var/www/maboutique.fr -type f -exec chmod 644 {} \;
chown -R www-data:www-data /var/www/maboutique.fr
9. Optimisation
Activez le cache Smarty et CCC (Combine, Compress, Cache) depuis le back-office sous Parametres avances > Performances. Pour un VPS IONOS avec suffisamment de RAM, activez egalement Memcached dans la configuration PHP.
Votre boutique PrestaShop est desormais en ligne et prete a accueillir vos premiers clients.