Install PrestaShop on Debian

Install PrestaShop on Debian

In this post we’ll show you how to install PrestaShop on  Debian, with PHP-FPM and Nginx. PrestaShop is an open-source eCommerce solution, committed to providing the best online shopping experience for both consumers and merchants. PrestaShop comes with many features such as Catalog Management, Product Displays, Site Management, Search Engine Optimization, Multi-store management, Analytics & Reporting and many more. Installing PrestaShop on Debian, is easy task if you carefully follow the steps below.

Install Nginx, MySQL and PHP-FPM

apt-get install nginx php5-fpm php5-cli php5-gd php5-mcrypt php5-mysql mysql-server mysql-client

Create a new database for the shop

CREATE DATABASE presta CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON presta.* TO db_user@localhost IDENTIFIED BY 'db_user_passwd';

Create a root directory for the shop

mkdir -p /var/www/{public_html,logs}

Download and extract PrestaShop

cd /var/www/
mv prestashop/* .
rmdir prestashop/

Run the following command to set the correct ownership

chown -R www-data: /var/www/

Nginx configuration.

Create a new Nginx server block with the following content

# /etc/nginx/sites-available/
server {
  listen 80;
  root /var/www/;
  access_log /var/www/;
  error_log /var/www/;

  index index.php;

  rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;
  rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*.jpg$ /img/p/$1/$1$2.jpg last;
  rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*.jpg$ /img/p/$1/$2/$1$2$3.jpg last;
  rewrite ^/([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*.jpg$ /img/p/$1/$2/$3/$1$2$3$4.jpg last;
  rewrite ^/([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5.jpg last;
  rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6.jpg last;
  rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7.jpg last;
  rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8.jpg last;
  rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9.jpg last;
  rewrite ^/c/([0-9]+)(-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*.jpg$ /img/c/$1$2.jpg last;
  rewrite ^/c/([a-zA-Z-]+)/[a-zA-Z0-9-]+.jpg$ /img/c/$1.jpg last;
  rewrite ^/([0-9]+)(-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*.jpg$ /img/c/$1$2.jpg last;
  try_files $uri $uri/ /index.php?$args;

  location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
    access_log off;
    expires max;

  location ~ \.php {
    fastcgi_index index.php;
    fastcgi_split_path_info ^(.+\.php)(.*)$;
    include /etc/nginx/fastcgi_params;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

Symlink it and restart the server

ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/
/etc/init.d/nginx restart

Open your browser and navigate to and follow the onscreen instructions. After the installation is complete, do not forget to remove the installation directory.

rm -rf var/www/

Of course you don’t have to Install PrestaShop on Debian, if you use PrestaShop Hosting services in which case you can simply ask our expert Linux admins to PrestaShop on Debian, for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post, on how to Install PrestaShop on Debian,  please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

1 thought on “Install PrestaShop on Debian”

Leave a Comment

To prove you are human please solve the following *