Install PrestaShop on Debian Wheezy VPS with PHP-FPM and Nginx

prestashopIn this post we’ll show you how to install PrestaShop on a Debian Wheezy VPS 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.

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 do any of this if you use one of our Linux VPS Hosting services in which case you can simply ask our expert Linux admins to install this for you. They are available 24×7 and will take care of your request immediately.

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

How to install Laravel on Linux
Setup and configure a mail server with PostfixAdmin
How to install MediaWiki on an Ubuntu 16.04 VPS
  • Bob


    Author Reply

    Good explanation, thx! Still works for PS1.6.