Secondary websites on multisite installation yields 502 Request Error

Hi there,

Local is really slick! I like it a lot, even in spite of the issues with it living inside a virtual environment.

Here’s my issue: I’ve created a WP installation that’s configured as a multisite install (subdomain, not subdirectory). Visiting the primary / first site (name1.local) in a web browser works fine. Visiting any other secondary sites (such as name2.local) just yield the 502 Request Error page in the web browser. I’ve reviewed the Router Log file as the webpage instructs, but it’s mostly Greek to me.

How can I troubleshoot this issue?

Thank you!

Saul

Hey @saul.baizman

Improving Multisite usage in Local is on our roadmap of things to work on soon, but in the meantime there are a few things to do when troubleshooting this.

The main thing to remember is that with Local development, Local has to tell the computer’s browser where to go to find a site. By default, web-browsers will look to the internet as opposed to the local machine.

Since the main site is responding, that means that Local is doing what it needs to, and what’s likely going on is that the Hosts file needs to be updated to include the subsites. The Hosts file is a file that lets the computer (and your web browsers) know where to look for a site when you try to access it in a Web Browser.

Can you take a look at your hosts file and see if it has entries for the subsite urls?

Here’s a blog post that outlines how to open the hosts file:

Here’s an example of what my Hosts file looks like, but you might have a different IP address for the Local sites:

image

Let me know if adding the subsite URLs to the Hosts file allows you to access those subsites!

Ben,

Thanks for your response. The /etc/hosts file is OK. Here are the entries:

192.168.95.100 cas.local #Local Site
192.168.95.100 tbdp.local #Local Site

I opened up the Router Log file and saw this entry repeated multiple times:

2019/09/11 01:21:23 [error] 6#6: *8876 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.95.1, server: 826-boston.local, request: "GET /favicon.ico HTTP/1.1", upstream: "http://192.168.95.100:4008/favicon.ico", host: "tbdp.local", referrer: "http://tbdp.local/"

Here’s the odd thing: I typed the web address “tbdp.local” into the browser’s address bar, but the log file says that a server named 826-boston.local is trying to respond. This hostname is another multi-site installation, which was not running at the time the instance for cas.local was running.

The other thing that stands out is the error number and message: 111: Connection refused. Is there any way to run Local with a higher debug level to see greater detail and derive more insight?

Any thoughts about that?

Saul

You can think of the Router Log as an NGINX log for how the requests are being routed to the individual sites.

With that in mind the “upstream” part refers to the actual site within Local, and not the specific router layer.

Since the 826-boston.local domain is for a completely different network, that makes me think that there is a setting within the tbdp.local network that is referring to the other domain.

I’m not 100% sure that top level domains can work in this case of multisites within Local, but would love to see what you come up with. A couple of things I would recommend:

  1. Scour through the database of the tbdp.local network and see if you can find any references to 826-boston.local. Try to make updates so that this domain isn’t being used.

  2. Try renaming the subsites to be actual subdomains of the main site. So cas.local might become cas.tbdp.local. Remember that renaming domains for multisites isn’t as simple as searching and replacing within the database. You can use this site to help generate the necessary SQL for transforming those domains: http://wpmultisitedomainreplace.com/

Hope that helps give some more things to consider while working with Multisite in Local!

Thanks for your response, Ben. In the interim two months, I’ve had to give up on the platform due to these issues. When they get straightened out, perhaps I’ll reconsider adopting Local.

1 Like