Cant access localhost on the phone

androidlocalhostPHP

I have an android connected to wifi. I want to access the localhost from my windows pc with my phone because i am creating a mobile web app that i want to access through my localhost in the phone. I tried 192.168.x.x/8080/. I also tried the routers ip with it. I dont know if i am doing anything wrong. Firewall is off and i followed every instructions i could see on stackoverflow but none of it work for me. I also tried google for answers almost all of it works to install a localhost to my phone none for actually accessing it in my phone. Thanks in advance.

Best Answer

Two things to try:

  • To check what port apache is listening for, go to your apache directory, open the conf sub-directory, and open httpd.conf. Look for "Listen." I believe it's 80 by default, but just to be sure, edit it to read:

    Listen 80

Or set it to whatever port you want, but 80 is the only one you won't have to explicitly type in your url.

  • Open a command prompt on your pc and type ipconfig. Try the IPv4 address in your Android's browser (mine is 10.0.0.2 and connects to my apache server just fine).

Your problem could obviously be anything, but these are some common solutions.