A dockerized version of PrestaShop using the latest stable versions of Nginx, PHP FastCGI Process Manager and MySQL linked together by docker-compose.
Prerequisite:
- Docker and Docker-compose are installed on your system.
- You have cloned this repository.
Here are the steps to get started:
- Change into directory:
cd nginx-prestashop
Your directory should now look like this:
.
├── docker-compose.yml
├── docker-images
│ ├── mysql
│ │ ├── Dockerfile
│ │ └── my.conf
│ ├── nginx
│ │ ├── Dockerfile
│ │ └── site.conf
│ └── php-fpm
│ └── Dockerfile
├── documentation
│ └── containersNetwork.png
├── install-Nginx-PrestaShop.sh
├── install-Nginx-PrestaShop1.7.sh
├── LICENSE
└── README.md
- Next download the PrestaShop source and unzip it. The stable version currently is 1.6.1.13.
# Download the PrestaShop source
wget https://www.prestashop.com/download/old/prestashop_1.6.1.13.zip
# Unzip the PrestaShop archive
unzip prestashop_1.6.1.13.zip
# Remove zip and install file
rm prestashop_1.6.1.13.zip Install_PrestaShop.html
- Set the correct user and group ownership for the PrestaShop directory (run as root).
sudo chown -R www-data:www-data prestashop/
Your directory should now look like this:
.
├── docker-compose.yml
├── docker-images
│ ├── mysql
│ ├── nginx
│ └── php-fpm
├── documentation
│ └── ...
├── prestashop
│ └── ...
├── install-Nginx-PrestaShop.sh
├── install-Nginx-PrestaShop1.7.sh
├── LICENSE
└── README.md
All the steps are defined in this script install-Nginx-PrestaShop.sh.
- Set strong passwords in the .env file.
#To do: change for production environment
MYSQL_ROOT_PASSWORD=mysql-root-pwd
MYSQL_USER=mysql-user
MYSQL_PASSWORD=mysql-pwd
MYSQL_DATABASE=prestashop
-
Start your PrestaShop using
docker-compose up
. -
Follow the installation steps of PrestaShop.
The MySQL's server name is
sql-server
.Do not forget to delete the
install
folder in the PrestaShop directory in the end. As the directory now belongs to 'www-data' switch to that user or run as root:
sudo rm -r prestashop/install
To stop your PrestaShop simply type: docker-compose stop
.
The dockerized version of your PrestaShop consists of the following containers:
- Nginx web server image
- PHP php:fpm image
- MySQL MySQL image
- phpMyAdmin PHP My Admin image (on port 9010)
- Portainer Portainer image (on port 9000). Added for illustrative purposes only, not needed for production.
The screen shot below visualizes the setup:
By default dummy certificates are used (see docker-images/nginx/Dockerfile). If you want to use a different certificate you can override the key and cert with your own certificates. If proper certificates are used HTTP2 is supported.
- Add an example of how to link to an existing MySQL database instance.
Thanks to Andreas Koch for his excellent examples on dockerizing Magento. Have a look at a blog-post of his: Dockerizing Magento.
nginx-prestashop is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.