# PrestaShop E-commerce Platform

> Open source e-commerce with PrestaShop, MySQL, and caching.

- Category: E-Commerce & Business
- Difficulty: intermediate
- Components: prestashop, mysql, redis, nginx, phpmyadmin
- Tags: prestashop, ecommerce, php, shop, multilingual
- Source: https://docker.recipes/ecommerce/prestashop-complete

## Overview

PrestaShop is a feature-rich open-source e-commerce platform written in PHP that powers over 300,000 online stores worldwide. Originally launched in 2007, PrestaShop offers a comprehensive solution for building and managing online stores with support for multiple languages, currencies, and payment gateways. The platform includes built-in SEO tools, product catalog management, order processing, customer management, and a modular architecture with thousands of available themes and modules. This stack combines PrestaShop with MySQL for robust data storage, Redis for high-performance caching and session management, NGINX as a high-performance web server and reverse proxy, and phpMyAdmin for database administration. The MySQL database handles all product data, customer information, orders, and configuration settings, while Redis significantly improves page load times by caching frequently accessed data and storing user sessions. NGINX serves static assets efficiently and handles SSL termination, providing better performance than Apache for high-traffic scenarios. This combination is ideal for merchants launching new online stores, developers building e-commerce solutions for clients, or businesses migrating from hosted platforms to self-managed infrastructure. The stack provides enterprise-level performance and scalability while maintaining the flexibility to customize every aspect of the shopping experience, from checkout flows to inventory management.

## Features

- Multi-store management allowing multiple shops from single PrestaShop installation
- Redis-powered session storage and object caching for improved checkout performance
- MySQL InnoDB storage engine with ACID compliance for reliable transaction processing
- NGINX FastCGI processing with optimized PHP-FPM integration for PrestaShop
- phpMyAdmin interface for managing product catalogs, customer data, and order history
- PrestaShop's built-in multi-language and multi-currency support with localized URLs
- Redis Pub/Sub messaging for real-time inventory updates across multiple store instances
- NGINX rate limiting and connection throttling to prevent cart abandonment during traffic spikes

## Use cases

- Small to medium online retailers launching their first e-commerce website
- Digital agencies building custom e-commerce solutions for multiple clients
- Existing merchants migrating from Shopify or WooCommerce to self-hosted platform
- Multi-brand retailers managing separate storefronts with shared inventory
- International businesses requiring multi-language and multi-currency support
- Developers creating custom B2B e-commerce portals with specialized pricing logic
- Fashion and electronics retailers needing advanced product variation management

## Prerequisites

- Docker Engine 20.10+ and Docker Compose 2.0+ installed on host system
- Minimum 2GB RAM available (MySQL 1GB, PrestaShop 512MB, Redis 256MB, NGINX 128MB)
- Ports 80, 443, and 8081 available on host system for web and database access
- Basic understanding of PHP application deployment and MySQL database management
- SSL certificate files if enabling HTTPS in production environment
- NGINX configuration knowledge for customizing reverse proxy and caching rules

## docker-compose.yml

```yaml
services:
  mysql:
    image: mysql:8.0
    environment:
      - MYSQL_DATABASE=prestashop
      - MYSQL_USER=prestashop
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
    volumes:
      - mysql_data:/var/lib/mysql
    networks:
      - prestashop_net

  redis:
    image: redis:7-alpine
    volumes:
      - redis_data:/data
    networks:
      - prestashop_net

  prestashop:
    image: prestashop/prestashop:latest
    environment:
      - DB_SERVER=mysql
      - DB_NAME=prestashop
      - DB_USER=prestashop
      - DB_PASSWD=${MYSQL_PASSWORD}
      - PS_DOMAIN=localhost
      - PS_FOLDER_ADMIN=admin123
      - PS_FOLDER_INSTALL=install
      - PS_ENABLE_SSL=0
    volumes:
      - prestashop_data:/var/www/html
    depends_on:
      - mysql
    networks:
      - prestashop_net

  nginx:
    image: nginx:alpine
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf:ro
      - prestashop_data:/var/www/html:ro
    depends_on:
      - prestashop
    networks:
      - prestashop_net

  phpmyadmin:
    image: phpmyadmin:latest
    ports:
      - "8081:80"
    environment:
      - PMA_HOST=mysql
    depends_on:
      - mysql
    networks:
      - prestashop_net

volumes:
  mysql_data:
  redis_data:
  prestashop_data:

networks:
  prestashop_net:
```

## .env

```bash
# PrestaShop
MYSQL_PASSWORD=secure_mysql_password
MYSQL_ROOT_PASSWORD=secure_root_password

# Shop at http://localhost
# Admin at http://localhost/admin123
# Delete /install after setup
```

## Usage notes

- Shop at http://localhost
- Admin at http://localhost/admin123
- Complete installation wizard first
- Delete /install folder after setup
- Configure caching modules for Redis

## Troubleshooting

- PrestaShop installation wizard shows database connection error: Verify MYSQL_PASSWORD environment variable matches DB_PASSWD in PrestaShop service
- Products and categories load slowly after initial setup: Enable PrestaShop's Redis cache module in Back Office > Advanced Parameters > Performance
- NGINX shows 502 Bad Gateway during PrestaShop container startup: Add health check or increase NGINX upstream timeout in configuration file
- phpMyAdmin cannot connect to database: Ensure both services are on prestashop_net network and PMA_HOST matches MySQL service name
- PrestaShop admin panel redirects to installation wizard: Remove install folder from prestashop_data volume and restart container
- Redis connection fails in PrestaShop cache settings: Configure cache servers with redis:6379 as server address in Performance settings

