Multisite - my server is wrong for the request for subsites

Bug Summary

localwp Version 8.3.1+6650

client: ::1, server: alcormizar.vtx, request: "GET / HTTP/2.0", upstream: "http://127.0.0.1:10145/", host: "jhs.swlauriersb.vtx"

The server is always the first none-active site.
Note : i dont have any site group

Steps to reproduce

Create multisite, sync domains in hosts file, try to open subsite.

Environment Info

Describe your environment.

  • Windows 10
  • PHP 7.4.30, MySQL 8.0.16 is used?
  • localwp Version 8.3.1+6650

Supporting info

2024/03/13 10:12:59 [error] 3884#20600: *13 connect() failed (10061: No connection could be made because the target machine actively refused it) while connecting to upstream, client: ::1, server: alcormizar.vtx, request: "GET /favicon.ico HTTP/2.0", upstream: "http://127.0.0.1:10145/favicon.ico", host: "jhs.swlauriersb.vtx", referrer: "https://jhs.swlauriersb.vtx/"
2024/03/13 10:37:42 [error] 3884#20600: *29 connect() failed (10061: No connection could be made because the target machine actively refused it) while connecting to upstream, client: ::1, server: alcormizar.vtx, request: "GET / HTTP/2.0", upstream: "http://127.0.0.1:10145/", host: "jhs.swlauriersb.vtx"
2024/03/13 10:37:44 [error] 3884#20600: *29 connect() failed (10061: No connection could be made because the target machine actively refused it) while connecting to upstream, client: ::1, server: alcormizar.vtx, request: "GET /favicon.ico HTTP/2.0", upstream: "http://127.0.0.1:10145/favicon.ico", host: "jhs.swlauriersb.vtx", referrer: "https://jhs.swlauriersb.vtx/"
2024/03/13 10:37:49 [error] 3884#20600: *29 connect() failed (10061: No connection could be made because the target machine actively refused it) while connecting to upstream, client: ::1, server: alcormizar.vtx, request: "GET / HTTP/2.0", upstream: "http://127.0.0.1:10145/", host: "jhs.swlauriersb.vtx"

Hey @vortex_joff Welcome to the Local Community Forums!

Working with multisites in Local can be tricky, but there might be a couple of things to try.

I think part of the problem is that there are different domains in use. Right now, Local doesn’t have a way to do domain mapping, for example, there can’t be more than one domain in use for the various subsites.

My guess is that if you instead did a search-and-replace for the various urls and made them subdomains of the main domain used by the network, then things might work.

So for example, you would:

  1. use something like wpcli to search for alcormizar.vtx and replace it with site1.mymultisite.local
  2. replace jhs.swlauriersb.vtx with site2.mymultisite.local
  3. etc… for each domain/subsite
  4. Click the “sync domains in hosts file” button again so that the site1..., site2..., site3... subdomains are added to the hosts file
  5. Visit the urls again

One possible alternative is if you manually add all of those alternative domains to your hosts file and point it to where the local site is listening (it looks like http://127.0.0.1:10145 in the error log). That may or may not work, because I’m not sure if those requests would resolve correctly, but it might be worth a try.

1 Like

Hello @ben.turner ,

Thank you for your answer,
I’vs alreday done this step with this URL : https://multisitedomainreplace.flywheelsites.com/
Or with a wp search-replace command

My hosts file editor is correct with the sync multisite domains to hosts file.

My problem is really with the server at the beginning :

2024/03/13 10:37:49 [error] 3884#20600: *29 connect() failed (10061: No connection could be made because the target machine actively refused it) while connecting to upstream, client: ::1, server: alcormizar.vtx, request: “GET / HTTP/2.0”, upstream: “http://127.0.0.1:10145/”, host: “jhs.swlauriersb.vtx”

See my screenshot I uploaded, it takes the first site because it does not detect the active site.
Note: When I reach the main site, I have no problem. “schools.swlauriersb.vtx”

My last option is really to play with the port in the hosts file but it is out of the localwp functionnality.
2024-03-15 10_22_52-Local