Fast response time of the server is the one of the main requirements which each e-commerce shop has to pass. There are many shared hosting options which cost lost of money. To reduce this cost to minimum good option is to choose a VPS (Virtual Private Server). It requires some technical knowledge but price to performance profit are big.
At the beginning you should find some cheep VPS. First advantage of VPS is that you can easily upgrade they “hardware” by 1-click. Almost all providers give that option.
Nginx server
When you have yours VPS installed and configured you have to install nginx server. It will be our reverse-proxy.
apt update
apt install nginx
Here you can fine a good starter config for nginx server. Of course you have to change a domain name. On this page you have an instruction how to install this configuration and how to setup SSL certificate for your domain (it’s totally FREE!).
You have to add new file in /etc/nginx/conf.d
directory. Name it upstreams.conf
. As a content of the file put:
upstream prestashop_extalion_com {
server 127.0.0.1:1234;
}
This will allow to forward a request from our nginx server to our docker-compose
Prestashop stack. Port 1234 has to be the same as the port in docker-compose
stack.
Reload nginx service (nginx -t && nginx -s reload
) and go to next step!
Prestashop docker
There is a nice docker-compose
stack, click here! On your VPS go to /var/www/prestashop.extalion.com and clone this repository:
git clone git@github.com:eXtalionLab/prestashop_docker.git .
or download a *.zip file and unzip it:
wget https://github.com/eXtalionLab/prestashop_docker/archive/refs/heads/master.zip
unzip master.zip
After that create and update config in .env file:
cp .env.dist .env
- If you want to run production environment uncomment
COMPOSE_FILE
env. PS_DOMAIN
has to be the same as your domain name in /etc/nginx/sites-available/prestashop.extalion.com.PRESTASHOP_PORT
env has to have the same port as in/etc/nginc/conf.d/upstrems.conf
file.- More about other envs you can read here.
When you’re done it’s time to build and run our new Prestashop instance:
docker-compose up -d && docker-compose logs -f
First docker
will download and build a new images. After that Prestashop scripts will install and setup new instance base on env vars. Be patient!
When you will see this line in logs:
NOTICE: ready to handle connections
you’re ready to enjoy with your shop.
One response to “Run Prestashop with docker”
[…] of all you have to move your shop from shared hosting to VPS or dedicate server. Here you can read how to run Prestashop with docker. With this setup (own server) you can modify many […]