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:
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.
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Accel-Internal /internal-nginx-static-location;
#<s - begin edit>
# Error Log not needed anymore, when the "large Cookie problem" is solved
#error_log /PATH/TO/LOGFILE notice;
proxy_buffers 16 16k;
fastcgi_buffers 16 12k;
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.
or for just one host:
/usr/local/psa/admin/sbin/httpdmng –reconfigure-domain shop.YOURDOMAIN.TLD