Skip to content

A dockerized version of PrestaShop using Nginx, PHP FastCGI Process Manager and MySQL linked together by docker-compose.

License

Notifications You must be signed in to change notification settings

tkaplan/nginx-prestashop

Repository files navigation

PrestaShop using Nginx and PHP:FPM with Docker Compose

A dockerized version of PrestaShop using the latest stable versions of Nginx, PHP FastCGI Process Manager and MySQL linked together by docker-compose.

Installation

Prerequisite:

  • Docker and Docker-compose are installed on your system.
  • You have cloned this repository.

Here are the steps to get started:

  1. 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
├── LICENSE
└── README.md
  1. Next download the PrestaShop source and unzip it. The stable version currently is 1.6.1.10.
# Download the PrestaShop source
wget https://www.prestashop.com/download/old/prestashop_1.6.1.10.zip

# Unzip the PrestaShop archive
unzip prestashop_1.6.1.10.zip

# Remove zip and install file
rm prestashop_1.6.1.10.zip Install_PrestaShop.html
  1. 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
   ├── LICENSE
   └── README.md

All the steps are defined in this script install-Nginx-PrestaShop.sh.

Starting your PrestaShop

  1. Set strong passwords in the docker-compose.yml file.
   mysql:
       build: docker-images/mysql
       hostname: sql-server
       volumes:
           - ./mysql:/var/lib/mysql
       environment:
           MYSQL_ROOT_PASSWORD: mysql-root-pwd
           MYSQL_USER: mysql-user
           MYSQL_PASSWORD: mysql-pwd
           MYSQL_DATABASE: prestashop
  1. Start your PrestaShop using docker-compose up.

  2. 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

Stopping your PrestaShop

To stop your PrestaShop simply type: docker-compose stop.

Containers

Overview

The dockerized version of your PrestaShop consists of the following containers:

  1. Nginx web server image
  2. PHP php:fpm image
  3. MySQL MySQL image
  4. phpMyAdmin PHP My Admin image (on port 9010)
  5. UI For Docker UI for Docker image (on port 9000). Added for illustrative purposes only, not needed for production.

The screen shot below visualizes the setup (screen shot taken from 'UI For Docker', tab 'Containers Network'):

NGINX PrestaShop: Containers Network

Using different SSL certificates

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.

To Do

  • Add an example of how to link to an existing MySQL database instance.

Thanks

Thanks to Andreas Koch for his excellent examples on dockerizing Magento. Have a look at a blog-post of his: Dockerizing Magento.

Licensing

nginx-prestashop is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.

About

A dockerized version of PrestaShop using Nginx, PHP FastCGI Process Manager and MySQL linked together by docker-compose.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages