I have a default drupal 8 site install and a sub directory site install. The second Drupal site was an after thought and had to be hosted on the default site url in a sub folder. both sites share the same database with the second site having a prefix for its tables.

The issue i am experiencing with the second site, the landing page works perfectly but any other page gives an issue, oddly enough when i view on incognito the other pages work but when i refresh i get the 502 Bad Gateway error.

folder structure is as follows

 - core
 - libraries
 - modules
 - node_modules
 - profiles
 - sites
 - themes (custom default theme here)
 - vendor
 - site2 (where i installed the second site with its own custom theme)
 - default drupal files (index.php, .htaccess ....)

I didn't change anything in both .htaccess files, i also tried in site2 .htaccess uncommented and updated the RewriteBase /site2 but still get the 502.

If someone could point me to the right direction regarding this issue, i have googled and tried numerous changes to the .htaccess files.

  • In all likelihood a 502 won't be related to anything in .htaccess. It generally means that the backend process (FPM) crashed before sending a valid response to the web server. It's a common problem that in my experience is rarely, if ever, caused by Drupal itself, rather mis-configuration of the FPM process, not enough memory, or something of that ilk. You'll find some troubleshooting pointers here: stackoverflow.com/questions/4252368/nginx-502-bad-gateway
    – Clive
    Aug 14, 2019 at 10:40
  • Hi Clive, thanks for the feedback, would updating the memory limit also help in this regard as the memory limit is set to 128M.
    – Lloyd_07
    Aug 14, 2019 at 11:48
  • It certainly could do, but it's difficult to get a good idea without being in front of the machine with the problem
    – Clive
    Aug 14, 2019 at 12:04
  • Hi Clive, I think this might be a prob with the system admin that handles our server. Thanks once again..
    – Lloyd_07
    Aug 15, 2019 at 13:30
  • Hi Clive, just some weird thing that was happening on the live server. The page that was giving issues was a form page, so what i ended up doing, i added the form fields on-by-one and when i added all 16 fields, it gave the above error. So i ended up having 12 fields the page worked and form submitted, will investigate this issue.
    – Lloyd_07
    Aug 19, 2019 at 8:11


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.