我的问题是我的手机无法访问使用nginx的本地网络中的服务器
我可以直接从我的机器访问它,就像我可以从genymotion模拟器访问一样:

但是我的安卓手机(7.1.2 N2G47H;Redmi Note5A版本)无法加载它。在浏览器(Chrome 68.9.3440.91)提示超出响应时间之前,它一直处于加载状态。
我尝试通过本地网络(192.168.1.123)中的机器的IP访问服务器
但是,如果我使用python中的SimpleHTTPServer模块提供文件,它工作得很好,文件已经被提供了。
nginx.conf:
user tauyekel staff;
worker_processes auto;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
client_max_body_size 128M;
gzip on;
gzip_comp_level 5;
gzip_min_length 256;
gzip_proxied any;
gzip_vary on;
gzip_types
application/atom+xml
application/javascript
application/json
application/rss+xml
application/vnd.ms-fontobject
application/x-font-ttf
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
image/svg+xml
image/x-icon
text/css
text/plain
text/x-component;
server {
listen *:80;
# serve static files
location ~ ^/.*$ {
root /Users/tauyekel/Documents/webprojects/mobile-test;
}
}
}我的包含静态文件的目录由单个index.html组成
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Mobile Test</title>
</head>
<body>
<h2>Tauka!</h2>
</body>
</html>iOS设备也不走运
感谢任何人的帮助,谢谢
发布于 2019-02-16 07:45:20
我不确定我是否正确理解了你的问题,但我想知道你的手机是如何连接到你的网络的?您的计算机通过以太网线或wi-fi连接到它。这为它分配了网络内的IP地址,并且该连接可以被解析。你的手机也使用wi-fi吗?或者您只是打开浏览器窗口并键入IP地址?如果没有与本地网络的wi-fi连接,手机将使用手机提供商的网络连接来连接互联网。问题是,您的计算机IP地址192.168.1.123是一个专用网络地址,无法从internet访问。
https://stackoverflow.com/questions/52245075
复制相似问题