15,032
edits
| (6 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
如何測試與排除網路服務連線問題。找出問題發生的地方:(1) 伺服器上的本地服務 (localhost) (2) 從區域網路到伺服器 (3) 從廣域網路到伺服器 | 如何測試與排除網路服務連線問題。找出問題發生的地方:(1) 伺服器上的本地服務 (localhost) (2) 從區域網路到伺服器 (3) 從廣域網路到伺服器 | ||
{{LanguageSwitcher | content = [[Test connectivity for the web service | EN]], [[網路服務連線測試 | 漢字]] }} | |||
=== 如何連線到網路服務 (Web 服務) === | === 如何連線到網路服務 (Web 服務) === | ||
| Line 32: | Line 32: | ||
# {{kbd | key = telnet 127.0.0.1 <PORT>}} 如果連接網頁服務失敗。它將顯示消息:"telnet: 無法連接到遠程主機:連接被拒絕" | # {{kbd | key = telnet 127.0.0.1 <PORT>}} 如果連接網頁服務失敗。它將顯示消息:"telnet: 無法連接到遠程主機:連接被拒絕" | ||
如果安裝了 Python 或 Node.js,則可使用替代網站服務 | |||
* ( | * (適用 python 3.x) {{kbd | key=<nowiki>python -m http.server <port></nowiki>}} (預設 port: 8000)<ref>[https://docs.python.org/3/library/http.server.html http.server — HTTP servers — Python 3.13.2 documentation]</ref> | ||
* ( | * (適用 Node.js) {{kbd | key=<nowiki>npx http-server -p <port></nowiki>}} (預設 port: 8080)<ref>[https://github.com/http-party/http-server http-server: a simple static HTTP server]</ref> | ||
== 測試本地網路服務的連接性 == | == 測試本地網路服務的連接性 == | ||
WAN ○ -------> ○ LAN -------> <span style="color:red">● 伺服器</span> | WAN ○ -------> ○ LAN -------> <span style="color:red">● 伺服器</span> | ||
{{Tips}} 如果您有管理權限通過SSH或遠程桌面服務登錄伺服器。 | |||
=== 檢查您的電腦/伺服器是否被指派了IP位址 === | === 檢查您的電腦/伺服器是否被指派了IP位址 === | ||
| Line 92: | Line 92: | ||
[https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers 維基百科 - TCP和UDP埠號列表] | [https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers 維基百科 - TCP和UDP埠號列表] | ||
Example output of netstat command, more on [[Find process running on port]] | |||
[[Find process running on port]] | |||
<pre> | <pre> | ||
$ netstat -tulpn | grep LISTEN | $ netstat -tulpn | grep LISTEN | ||
| Line 110: | Line 100: | ||
// means the 80 port service is running | // means the 80 port service is running | ||
</pre> | </pre> | ||
=== Check if a port is blocked by browser === | === Check if a port is blocked by browser === | ||