简体   繁体   English

通过Chrome的端口转发在Android设备上访问EasyPHP本地网站

[英]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. 我在Chrome PC上使用chrome:// inspect页面在Chrome Mobile上使用开发工具。
I have my js+webgl games on a "local" website, http :// 127 .0. 我在“本地”网站http://127.0上有我的js + webgl游戏。 0.1/site/, thanks to EasyPHP. 0.1 / site /,这要归功于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. 每当我进行编辑并想在Android上进行测试时,我都会将游戏上传到真实的Web服务器上,但是我确实更希望Android设备直接访问我计算机上的本地网站。
I know it is possible with the "port forwarding" feature on chrome://inspect, but I do not get it to work. 我知道可以通过chrome:// inspect上的“端口转发”功能进行操作,但是我无法使其正常工作。

It uses 8000 as port and localhost:8080 as address. 它使用8000作为端口,使用localhost:8080作为地址。
There is a green dot aside the name of my Android device, so port forwarding is supposed to work. 我的Android设备名称旁边有一个绿点,因此应该可以进行端口转发。
But when I open http :// 127 .0. 但是当我打开http://://127.0时。 0.1/site/ on the Android device, it says "Oops! Google Chrome could not connect to 127.0.0.1". 在Android设备上为0.1 / site /,则显示“糟糕!Google Chrome无法连接到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. 而且,如果您在操作系统上启用了ping命令,则可以使用它进行测试。

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. 为此,Easyphp运行Apache Web服务器来监听网络的请求。 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. Apache正在监听端口8080上的网络。Apache的灵活性是您可以在配置文件中自行更改该端口的数量。 ( see https://collab.its.virginia.edu/wiki/toolbox/example%20httpd.conf%20file.html ) (请参阅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. 该错误消息由您的Web服务器的内置安全系统抛出。 This security is most of the time provided on folder level with text files ( see http://www.htaccess-guide.com/ ) 大多数情况下,此安全性是在文件夹级别与文本文件一起提供的(请参阅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. 进行这些更改后,您可以从Android浏览器访问localweb文件夹(或?AMPP中的htdocs)。 And is the game on :-) 并且是游戏:-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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