Localhost unavailable to other applications after closing Local

Issue Summary

While I run sites via Local, I also run sites via Docker containers that may use 127.0.0.1:80 for web traffic. Once Local has been opened on my computer, I have to restart the computer to free these ports back up. After exiting Local, but w/o restarting the computer, trying to access domains assigned to 127.0.0.1 show the Local 404 page (" The site you requested does not have an associated route in Local.
If you continue to get this message after refreshing, try restarting the Local site.").

Troubleshooting Questions

  • Does this happen for all sites in Local, or just one in particular?

N/A

  • Are you able to create a new, plain WordPress site in Local and access it in a Browser?

N/A

Replication

  • Open Local
  • Start a site
  • Stop site
  • Close local
  • Run another site on 127.0.0.1. Current use case is Docker w/in WSL2, but could also apply to WAMP, XAAMP, etc.
  • See Local 404 page
  • Clear cache, disable cache, whatever
  • Still see Local 404 page

System Details

  • Which version of Local is being used?
    6.4.3+6116

  • What Operating System (OS) and OS version is being used?
    Win11 Pro, 21H2, build 22000.978

  • Attach the Local Log. See this Help Doc for instructions on how to do so:

local-lightning.log (140.1 KB)

Security Reminder

Local does a pretty good job of scrubbing private info from the logs and the errors it produces, however there’s always the possibility that something private can come through. Because these are public forums, always review the screenshots you are sharing to make sure there isn’t private info like passwords being displayed.

Hi @sternerstuff! Is this still an issue if you change the Router Mode to Site Domains? What is Router Mode? - Local

It is specifically a problem when “Site Domains” is the router mode.

Switching to “localhost” mode actually seems to resolve the issue.

1 Like

@Nick-B I’d like to add that I don’t think that it’s related to either mode. I would wager the bug is that Local isn’t freeing port 80 when you stop a site or close the application altogether. To go step by step through my troubleshooting of this theory:

Btw - if you’re encountering this bug, skip to the last 4 steps to continue work w/o restarting your computer.

  1. Boot computer
  2. Check out what’s happening on port 80 with netstat -ano | find "80" | find "LISTEN" and then wmic process where "ProcessID={process listening on 80}" get ProcessID, ExecutablePath Any time these steps reference activity on port 80, this is the process used to determine that
  3. Nothing on 80
  4. Start Local
  5. Nothing on 80
  6. Start site
  7. Port 80 is occupied by Local’s Nginx service (C:\Users\Ethan\AppData\Local\Programs\Local\resources\extraResources\lightning-services\nginx-1.16.0+6\bin\win32\nginx.exe)
  8. Stop site.
  9. Same process still living on port 80
  10. Quit Local
  11. Oddly enough, while writing these instructions, port 80 was freed!
  12. Start Local again
  13. Start site again
  14. Port 80 occupied again
  15. Stop site
  16. Quit Local
  17. Port 80 still occupied by Local nginx process
  18. Start Local
  19. Start site
  20. See a second process is now listening on port 80! Also Local’s nginx executable.
  21. Stop site
  22. Switch router mode from “Site Domain” to “Localhost”
  23. See the second nginx process has stopped, but the original one is still listening
  24. quit local
  25. 80 still occupied
  26. open task manager
  27. find nginx.exe
  28. force quit
  29. 80 is available

Obviously there’s a lot there, and I don’t know if it’ll help reproduce, but Local is not reliably stopping its nginx process.

Hi @sternerstuff! Thank you for all of the details here that is super helpful. I’ve raised this with our dev team. The intended functionality should be that Local is killing these processes upon shut down but after testing it does seem to be intermittent at times. We are going to look into this further with some more testing and see what can be done! We’ll be sharing any updates here or reaching out if we need any other follow-up.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.