Membership 2 Pro - User registration fails

I tried setting up Membership 2 pro plugin on one of my sites. I get error 502 error when the user clicks on register button while signing up for the membership. URL displayed on error page is /register/?step=payment_table&membership_id=2046. Error says: The page request was canceled because it took too long to complete