A llama.cpp server listener decides which clients can reach the local API and web UI. The default loopback listener keeps access on the same machine, while a LAN client, container, or reverse proxy needs an explicit bind address and a TCP port that is not already used.
llama-server can change its listener address and TCP port at startup. A loopback bind accepts only same-host clients, an all-interfaces bind accepts traffic arriving on any IPv4 interface, and a specific LAN address restricts the listener to that one interface when the operating system owns it.
Binding to all interfaces does not add authentication or firewall rules. Keep private model servers on loopback unless another machine or proxy must connect, and add the model source option already used for inference when the listener should serve a model immediately.
Use 127.0.0.1 for same-machine clients, 0.0.0.0 for all IPv4 interfaces, or the server's specific LAN address when only one interface should accept requests. The port must be unused on the host.
$ llama-server --host 0.0.0.0 --port 9091 llama_server: starting server in router mode llama_server: listening on http://0.0.0.0:9091
Router mode starts when no model source is supplied. Add --model /path/to/model.gguf, --hf-repo owner/model:quant, or --models-dir /path/to/models to the same startup command when the server should load a model.
Do not bind to 0.0.0.0 on an untrusted network unless firewall rules, a reverse proxy, or --api-key limits who can connect.
$ curl -sS -i http://127.0.0.1:9091/health
HTTP/1.1 200 OK
Keep-Alive: timeout=5, max=100
Content-Type: application/json; charset=utf-8
Server: llama.cpp
Content-Length: 15
Access-Control-Allow-Origin:
{"status":"ok"}
Use the server's LAN address or reverse-proxy hostname instead of 127.0.0.1 when checking access from another machine.
Related: How to check llama.cpp server health