简体   繁体   English

apache-无法连接到ubuntu和android之间的apache本地服务器

[英]apache - Can't connect to apache local server between ubuntu and android

I will try to explain this as briefly as possible, I was developing an app on Android Studio, running an emulator genymotion on Vbox, after finishing everything and running the django apache server, tried it first on localhost, using localhost:8000 on a browser, and it worked fine, tried afterwards on my emulator using an httppost on my app, kept getting "org.apache.http.conn.HttpHostConnectException: Connection to http://192.148.16.9:8000 refused" (the internet permission is included) 我将尝试尽可能简要地解释这一点,我在Android Studio上开发了一个应用程序,在Vbox上运行了genymotion仿真器,完成所有操作并运行了django apache服务器之后,首先在localhost上进行了尝试,在浏览器上使用localhost:8000 ,并且运行良好,随后在我的模拟器上使用应用程序上的httppost在模拟器上进行了尝试,并不断收到"org.apache.http.conn.HttpHostConnectException: Connection to http://192.148.16.9:8000 refused" (包含互联网许可)

I tried with several ips, 10.0.2.2:8000, the eth0 ip, the vbox ip (mentioned below), none worked, tried exporting the app to my phone, with several ips, and still won't work, tried accessing the server right through the browser (on phone and emulator) nothing working, the server didn't get any get or post requests except from the localhost session I did on same machine, searched for a solution in several questions here non helped, and asked elsewhere and still didn't help, I hope someone can help me, here's what I can provide, and mention if I've to provide anything else 我尝试使用多个ip,10.0.2.2:8000,eth0 ip,vbox ip(如下所述),均不起作用,尝试使用几个ip将应用程序导出到我的手机中,但仍然无法正常工作,尝试访问服务器通过浏览器(在电话和仿真器上)无法正常工作,服务器没有得到任何get或post请求,除了我在同一台计算机上进行的localhost会话外,在这里没有帮助的几个问题中寻找解决方案,并在其他地方提出了要求,仍然没有帮助,我希望有人可以帮助我,这是我可以提供的,并提及我是否必须提供其他任何东西

tcp        0      0 localhost:8000          *:*                     LISTEN

Probably is not apache ( listening on 80 and 443 ) but django, 可能不是apache(监听80和443),而是django,

try 尝试

./manage.py runserver 0.0.0.0:8000

see manage.py runserver 参见manage.py runserver

then retry 192.168.56.1:8000 然后重试192.168.56.1:8000

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

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