Comment to '502 error Bad Gateway'
  • The problem was caused by some wrong lines in the file /etc/nginx/sites-available/mainsite. First of all, it was not including the file /etc/nginx/una_params, which contains correct PHP settings. If your PHP version changes, you need to edit the file una_params, not mainsite.