简体   繁体   中英

Accessing an EasyPHP local website on an Android device via Chrome's port forwarding

I use chrome://inspect page on Chrome PC to use dev tools on Chrome Mobile.
I have my js+webgl games on a "local" website, http :// 127 .0. 0.1/site/, thanks to EasyPHP.

I use to upload the game to a real web server each time I make an edit and want to test it on Android, but I really would prefer the Android device to directly access the local website on my computer.
I know it is possible with the "port forwarding" feature on chrome://inspect, but I do not get it to work.

It uses 8000 as port and localhost:8080 as address.
There is a green dot aside the name of my Android device, so port forwarding is supposed to work.
But when I open http :// 127 .0. 0.1/site/ on the Android device, it says "Oops! Google Chrome could not connect to 127.0.0.1".

What am I doing wrong ?

As long you are in the same network ( fe your home network) both devices can see each other. And if you enabled the ping-command on your operating system you can use to test this.

On the application layer they need the same ports to also talk to each other. For this talking Easyphp runs the Apache webserver to listen the network for request. As you remarked; Apache is listening the network on port 8080. The flexibility of Apache is that you can change the number of that port yourself in the configuartion file. ( see https://collab.its.virginia.edu/wiki/toolbox/example%20httpd.conf%20file.html )

Once you completed this, you will get an error message that you have no access, and you should be happy because this means that both devices can already talk with each other :-)

The error message are thrown up by the build-in security-system of your webserver. This security is most of the time provided on folder level with text files ( see http://www.htaccess-guide.com/ )

Once made these changes your access your localweb folder (or htdocs in ?AMPP) from out the browser of your Android. And is the game on :-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM