Agentic Research

Localhost

Also: 本機 · 127.0.0.1 · loopback · 本地地址

"This very machine": localhost is the name, 127.0.0.1 the address. A service bound to it can be reached only from this computer.

When you will meet it

The first time you run a local model server, the browser shows an address shaped like http://localhost:11434 (Ollama's default). Knowing that address means "this machine only" resolves two confusions at once: why your phone cannot open your computer's service, and why "the service is running" does not expose it to the internet. Almost every tutorial from here on prints addresses of this shape.

An analogy

Like a house intercom: rooms can ring each other, but the street cannot ring in. Localhost is the computer's intercom to itself — the traffic never leaves the machine.

Minimal example

python3 -m http.server 8000 --bind 127.0.0.1 &   # 開一個只聽本機的服務
curl http://localhost:8000                       # 本機:連得到
curl http://127.0.0.1:8000                       # 同一個位址的另一種寫法
kill %1                                          # 玩完收掉

Point your phone (same Wi-Fi) at that address and it will not open — --bind 127.0.0.1 nailed the service to this machine. Reaching it from elsewhere requires binding to the LAN address or 0.0.0.0 (every interface). Many dev tools bind to localhost by default; that is the whole answer to "why can't I open it on my phone".

What people get wrong

  • Equating localhost with "my computer is serving the world". It is one loopback address: bound to 127.0.0.1 the LAN cannot see the service; bound to 0.0.0.0 every device on the LAN can knock. "It's running" does not say which case you are in — check the bind address.
  • Copying localhost out of a tutorial as a remote address, or substituting it for the server address. It always means "the machine executing this command right now": typed on machine A it reaches A itself — never the server where the service actually lives.

Related terms

Next