Published 4 years ago by JosephusPaye
I am working on a mobile optimized site and want to test my designs on a mobile phone, but when I enter the IP address of my development machine (Windows) into my phone's browser, I cannot get to the Homestead/Vagrant site. Also trying the Vagrant IP address doesn't help either, with or without the port included. I tried this approach because that's how I did it when I was using WAMP/XAMPP.
I've tried a few Google searches but can't find anything to help. Does anyone have any ideas on how I could do this?
I am a newbie and this is my first post here, so please consider me if there is something obvious I'm missing.
Thanks in advance.
in this example my app is called myapp and my notebooks network address is : 192.168.0.4
Where you reference your app in your hosts file you can just add another line like this:
and access it on another device on the network like this : 192.168.0.4:8000
Also keep in mind that sometimes Firewalls/Anti-virus can give a hard time on this, blocking the access without notice. I believe the VM firewall wouldn't block this, but windows firewall or anti-virus could, try disabling everything for some minutes and testing again, if it works you can enable it back and add an exception.
@henrique with just a standard windows install over local network only it shouldn't be a problem. at least in the last couple of years i've never experienced that issue. i did however have such an issue when making it public. but in that case it was the router that was refusing the connection :) but that is a whole other story
@5pArxz yeah, but we don't know what software he have installed, right? :)
Anyways, let's not transform his thread in a discussion about firewalls, he asked a question and I said one possibility, as I said "firewalls/ANTI-VIRUS CAN", so it's not only firewalls and it's not a certain thing :P
What type of network adapter does your VM has? Assuming you are using homestead I know it uses a NAT adapter with port forwarding. In that case just make sure the http forwarded port is open in your firewall.
If that doesn't work, just try disabling the firewall and/or antivirus just as @henrique said.
If the VM is using a Host-only adapter you'll have a hard time trying to reach it from outside.
One neat way to avoid all that hassle is using a bridged adapter to the ethernet interface. That way the VM is just like any other physical device on your network.
Sounds like it's possibly the firewall. Windows by default will block the inbound ports, so you need to open up a range.
If you're testing on various screen sizes definitely check out http://www.browsersync.io/
You can run it as a gulp task and it creates a proxy address which you can point loads of devices at - All your interactions, clicks, scrolls, etc are mirrored in real-time across all devices. It's the dogs danglers!!
I currently use this approach:
## # Homestead # # Homestead is the virutal machine running all local # web development applications. It's domains need to # be registered here one by one. ## 192.168.10.10 workbench-one.dev 192.168.10.10 workbench-two.dev ## # External Testing # # Route the network cards IP address to the Homestead # virtual machine so you can access it using port 8000. ## 192.168.1.6 192.168.10.10
(192.168.1.6 is my network cards IP address)
Now if i want to test workbench-two.dev on a smartphone for example i change following line in its nginx site config
listen 80 default_server;
Once done all i need to do is
sudo service nginx reload
If i browse 192.168.1.6:8000 from my smartphone i'll get to see the contents of workbench-two.dev. Of course you must remove default_server once you're done. If you have this on multiple configuration files, you'll run into trouble.