10up / wp-local-docker-v2

ARCHIVED: A simple Docker based development environment for WordPress.
MIT License
484 stars 82 forks source link

How to access WPLocalDocker-created site from another computer on the local network? #184

Open huyumott opened 3 years ago

huyumott commented 3 years ago

I have some WPLocalDocker-created sites on computer A (with static ip 192.168.1.5). I want to be able to also access these sites from computer B (with static ip 192.168.1.6) on the same local network over wifi. When not using a reverse proxy, I was able to do this by adding the domain into computer B's hosts file with the relevant ip. (Both computers have WP Local Docker installed.)

What adjustments do I need to make in order to access these sites located on computer A from computer B over LAN through the reverse proxy? It seems I may need to set the location with a proxy_pass in the sites' respective server.conf files, but it may require something more complicated involving upstream configurations.

Would appreciate any guidance. Many thanks.

azatecas commented 3 years ago

Im interested in this too! I recently got the M1 Mac and im having trouble setting up 10updocker, so i want to use my old computer as the server on my local network. With Xampp i dont have an issue accessing WP by visiting my old computer's ip address. But with 10updocker i haven't been able to configure it to work properly. Any hits are appreciated

dustinrue commented 3 years ago

Required disclaimer. We don't recommend doing this unless you are on a trusted networking.

With that out of the way, you can edit the ~/.wplocaldocker/global/docker-compose.yml you will find that services are listening on 127.0.0.1. If you remove that so it is just port:port, like 3306:3306, then it will be accessible at the IP of your machine.

azatecas commented 3 years ago

Thank you, i did this however now im running into dnsmasq issues since port 53 is already in use on Pop_OS! 20.10. By leaving dnsmasq with 127.0.0.1:53:53 the project started up and locally it works. But I get ngnix 503 error when attempting to access it from another computer. This is progress since before i couldnt even access it.

huyumott commented 3 years ago

dustinrue, your solution worked flawlessly for me, many thanks.

I removed 127.0.0.1 on all services except dnsmasq (like azatecas, I also found this one was required to avoid conflicts on port 53) and was able to access from all computers on the network.

I did have to troubleshoot a few things locally:

Many thanks again for the input, it's really appreciated.

huyumott commented 3 years ago

To follow up on this issue, I am now having trouble accessing interfaces for phpmyadmin and mailcatcher. Internally, global services seem to be working ok (data correctly stored into databases) but the browser interfaces are no longer valid, as mysqli is struggling with name resolution. Any troubleshooting advice would be greatly appreciated.