How can I access my localhost from my Android device?

前端 未结 30 2254
面向向阳花
面向向阳花 2020-11-21 05:53

I\'m able to access my laptop web server using the Android emulator, I\'m using 10.0.2.2:portno works well.

But when I connect my real Android phone, th

30条回答
  •  你的背包
    2020-11-21 06:24

    This is what worked for me, I added another line after the 127.0.0.1 ip to specify the exact local network ip address (not the public ip address) of the device I wanted to use. In my case my Samsung Galaxy S3

    As suggested by Bangptit edit the httpd.conf file (x being the version numbers): C:\wamp\bin\apache\Apache2.x.x\conf\httpd.conf

    Search for the onlineoffline tag and add the ip of your phone (I found my phones ip address in my routers configuration pages):

    onlineoffline tag - don't remove

     Order Deny,Allow
     Deny from all
     Allow from 127.0.0.1
    

    my phones ip in the line below

     Allow from 192.168.1.65 
     Allow from ::1
     Allow from localhost
    

    One could extend this to include an entire sub domain too for e.g. 192.168.1.0/24 etc

提交回复
热议问题