0

WebAccess

The title says it all. As you can see in screenshot I can successfully access apache using hostname I tried in in different computer same result. But when i use my mobile phone it says "site can't be reached." I tried pinging it in my phone but no luck. Please can u help me whats the problem here?

  • Is your Android device on the same network as your Raspberry Pi and computer? – Quintin Balsdon Oct 18 '17 at 6:56
  • Yes Sir.. just same network – Jhay02 Oct 18 '17 at 6:59
  • Is your phone able to access RPi via IP address? – Arpit Agarwal Oct 18 '17 at 7:25
  • @ArpitAgarwal yes i can access Apache using IP address but i want to access it using hostname.. – Jhay02 Oct 18 '17 at 7:48
  • I just tried it with my phone and RPi and it is accessible. In your mobile browser type http://pisowifi in address. It does Google search if you do not put http – Arpit Agarwal Oct 18 '17 at 8:38
0

I guess if you have to access via hostname you have to edit your host file on android so that it can know the hostname and redirect to the IP address of Pi

Add a line in hosts file with

IP-address-of-Pi    hostname(name by which you want to access pi)

I think to edit hosts file your device should be rooted

here are few links which might help
http://www.trishtech.com/2014/08/edit-hosts-file-in-android/
https://www.theandroidportal.com/edit-modify-hosts-file-block-websites-android-root/ https://android.stackexchange.com/questions/60150/how-to-edit-etc-hosts-file

Hope it helps!

  • I think this is not applicable if the users phone is not rooted. my aim is to connect on Apache without using a IP address but the hostname. I checked all possibilities but i dont why i cant connect on my android even if i can see him in network – Jhay02 Oct 20 '17 at 9:10
  • I think it's because the systems or servers on network or internet are fundamentally identified by IP address (since we cant remember IP address DNS comes into the picture so that it can redirect to the IP address mapped to the name.) When you try to connect to Pi on the phone if it says This site can’t be reached and server DNS address could not be found or ERR_NAME_NOT_RESOLVED. It most probably could be fixed by above method (editing the host file). To my knowledge, I think it could be done only if the phone is rooted because we are editing the internal files. – Sneha Oct 20 '17 at 15:02
  • Not a good method.. i think, but thanks for the @Sneha – Jhay02 Oct 21 '17 at 2:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.