【发布时间】:2018-09-09 13:40:15
【问题描述】:
我的问题是我的手机无法访问本地网络中使用 nginx 的服务器
我可以直接从我的机器访问它,也可以从 genymotion 模拟器访问它:
但我的安卓手机(7.1.2 N2G47H;Redmi Note 5A Build)无法加载。它一直卡在加载中,直到浏览器(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 设备也不行
我将不胜感激,谢谢
【问题讨论】: