我不能不能从同一局域网上的(真实)iOS设备连接到运行Nginx的macOS计算机。已为https
设置了Nginx。 iOS设备与macOS https的连接在我的LAN上使用Python的SimpleHTTPServer https setup。
✅ Setup WORKED with Python's SimpleHTTPServer running on https
✅ Ping from iOS to macOS https server
✅ Ping from macOS https server to iOS
✅ No firewall in the way / wifi blocking device-2-device comms
在托管Nginx和Web服务器的macOS计算机(localhost
)上使用浏览器时,我可以连接。
端口转发
在Mojave上,我确实需要向Port Forwarding
添加一些/etc/pf.conf
规则才能使其正常工作。
#nginx
rdr pass inet proto tcp from any to any port { 11443 } -> 127.0.0.1 port 11443
#SimpleHTTPServer
rdr pass inet proto tcp from any to any port { 10443 } -> 127.0.0.1 port 10443
Nginx正在运行
sudo lsof -iTCP -sTCP:LISTEN -n -P
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
Python 28360 root 3u IPv4 0xa12c8333afeff20f 0t0 TCP 127.0.0.1:10443 (LISTEN)
nginx 34890 root 11u IPv4 0xa12c8333a5b09f0f 0t0 TCP 127.0.0.1:11443 (LISTEN)
nginx 34891 nobody 11u IPv4 0xa12c8333a5b09f0f 0t0 TCP 127.0.0.1:11443 (LISTEN)
Nginx Conf文件
server {
listen 11443 ssl;
server_name localMac.local;
ssl_certificate /cert_chain.pem;
ssl_certificate_key /local.priv.pem;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
access_log /var/log/YDaccess.log;
error_log /var/log/YDerror.log;
location / {
add_header 'access-control-allow-origin' '*';
proxy_pass http://localhost:8080/;
}
}
include servers/*;
}
您能在我的Nginx conf文件中发现任何明显的错误吗?我是Nginx的新手。
在Nginx的访问/错误日志中没有明显的线索。就像请求从未到达Nginx。