Prestashop issues (502 Bad Gateway) with nginx as a Proxy server running on a Plesk Parallels enabled host

/, Embedded Systems and Micro controllers, Internet and Web Engineering/Prestashop issues (502 Bad Gateway) with nginx as a Proxy server running on a Plesk Parallels enabled host

Prestashop issues (502 Bad Gateway) with nginx as a Proxy server running on a Plesk Parallels enabled host

I am running a Plesk Parallels Panel (v. 11.0) on a Ubuntu 12.04 LTS with PrestaShop (v. 1.5.3) combined with a nginx webserver (v. 1.3.0) as a reverse proxy server.

Be aware, that in any other case the solution presented here might not work for you!

One of my friends (Sven Fennema) is running Presta Shop on my server to sell his beautiful pictures to the world. When I moved to nginx as a reverse proxy server in a Plesk Parallels environment, we recognized that Presta Shop is running into troubles with a „502 Bad Gateway“ error.

First I added error logging to the „/var/www/vhosts/shop.YOURDOMAIN.TLD/conf/last_nginx.conf“, what brought me to the following error:

2013/01/05 03:10:20

[error] 31522#0: *118 upstream sent too big header while reading response header from upstream, client: IP, server: shop.YOURDOMAIN.TLD, request: „POST /de/authentifizierung HTTP/1.1“, upstream: „http://SERVER:PORT/de/authentifizierung“, host: „shop.YOURDOMAIN.TLD“, referrer: „http://shop.YOURDOMAIN.TLD/language/authentifizierung?back=my-account“

This error is (, just shortly summarizing the problem look up in the web) because of very large Cookie files (because they are encrypted using Blowfish algorithm) generated by the shop engine. As there might be more shops that I am hosting in the near future I was searching for a general solution approach and not a „fast hack“.

After figuring out for a while, finally the solution is quite simple.

Just edit your nginxDomainVirtualHost.php like presented below.


In Plesk 11, you can find the file I was editing at „/usr/local/psa/admin/conf/templates/default/domain/nginxDomainVirtualHost.php“

Another option, just to enable this settings for one host would be to just edit the nginx config file of your shop domain


and after that lock it in the system:

chattr +i last_nginx.conf

But of course, this solution is not very elegant. 🙂

After editing the files you have to run the httpdmng of Plesk Parallels to get the config files updated.

/usr/local/psa/admin/sbin/httpdmng –reconfigure-all

or for just one host:

/usr/local/psa/admin/sbin/httpdmng –reconfigure-domain shop.YOURDOMAIN.TLD


  1. H4UnT3R 23. April 2013 at 09:27 - Reply

    Proxy buffer size worked!!! 😉

  2. jgomsi 10. Mai 2013 at 12:55 - Reply

    Thank you for sharing, your solution works like a charm. Just one thing: I believe you have to restart nginx for the changes take effect.
    Yesterday I edited nginx plesk template to add “proxy_read_timeout 300;” and now this…

  3. Angelic Noland 8. September 2013 at 18:57 - Reply

    Keep on working, great job!

  4. Bastien Vial-Collet 31. Mai 2014 at 12:31 - Reply

    Great fix, this is working well.
    What I did on my side as I am also using Plesk is that I added these for lines taken from your config file to the specific hosting parameters of the shop domain in Nginx specific instructions (not sure about the correct translation in English):
    proxy_buffers 16 16k;
    proxy_buffer_size 32k;
    fastcgi_buffer_size 32k;
    fastcgi_buffers 16 12k;

    Doing this, Nginx is restarted automatically and changes are persisted.

    • Sven Seiler 15. Juni 2014 at 12:46 - Reply

      Thanks for the feedback, Bastien. Great, that it works out for you. I think, adding it to the hosting parameters is even a better solution!

Leave A Comment