我創建好一個nginx伺服器,透過curl http://host_ip:port 有顯示出來,但在不同網路下測試卻無法連線,請各位大神幫忙解答。
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
{
"Name": "docker_default",
"Id": "1a3b24486029603f11f4e0dfbd0b52fbcf67900dea410da9a13fa57755fe7ba1",
"Created": "2022-04-05T17:42:45.049988619+08:00",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.21.0.0/16",
"Gateway": "172.21.0.1"
}
]
},
"Internal": false,
"Attachable": true,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"d1193b9ad3e87c3452b8924c9b3eafdb6d446ca31bc9c377fc33edc623b852f1": {
"Name": "test",
"EndpointID": "9b141bd41514fdaff607d5a22aa5b0791267b8d2bb8a724e011485876ace2f81",
"MacAddress": "02:42:ac:15:00:02",
"IPv4Address": "172.21.0.2/16",
"IPv6Address": ""
}
},
"Options": {},
"Labels": {
"com.docker.compose.network": "default",
"com.docker.compose.project": "docker",
"com.docker.compose.version": "1.29.2"
}
}
關於你的問題,得先釐清「不同網路下測試卻無法連線」
這邊指的不同網絡,是指不同網段的Lan、還是其他Wan?
如果是不同網段的Lan:那要看一下你的網路架構是怎麼樣的?光看這樣的資訊實在無法排查
如果是想要Wan能訪問,要先確定你的Server是不是已經有對外了