我設定了一個簡單的 nginx 伺服器,只要localhost
在瀏覽器中輸入即可運作。如果我嘗試從同一網路中的手機存取它,透過輸入電腦的 IP 位址,我會收到「網頁不可用」訊息。這是我的 nginx.conf:
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.fedora.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
server {
listen 80;
location / {
root /usr/share/nginx/html;
}
}
}
根據這帖子,我配置了我的防火牆允許家庭區域中的 http,並將無線網路設定在該區域。
iptables INPUT 鏈中的前兩個條目是
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
ACCEPT all -- anywhere anywhere
所以我認為這不是問題。
然而,查看從我的手機捕獲的 tcpdump 請求,我看到了一條回應host unreachable - admin prohibited
:
21:13:38.514782 IP 192.168.1.3.54982 > sidney.http: Flags [S], seq 2569820651, win 14600, options [mss 1460,sackOK,TS val 3018406 ecr 0,nop,wscale 6], length 0
21:13:38.514934 IP sidney > 192.168.1.3: ICMP host sidney unreachable - admin prohibited, length 68
輸出firewall-cmd --list-all --zone=home
:
home (active)
target: default
icmp-block-inversion: no
interfaces: wlo1
sources:
services: dhcpv6-client http mdns samba-client ssh
ports: 80/tcp
protocols:
masquerade: no
forward-ports:
sourceports:
icmp-blocks:
rich rules:
可能是什麼問題呢?我使用的是 Fedora 24。