Ollama binds its API to 127.0.0.1:11434 by default, which keeps local model access private to the machine. Changing OLLAMA_HOST exposes the server on another address or port for containers, LAN clients, or reverse proxies.

The bind address is a server setting, not a client setting. Set it in the service, desktop app environment, or foreground ollama serve process before starting Ollama.

Treat network exposure as a security boundary. Ollama's local API is not authenticated by default, so bind to a trusted interface or place an authenticated proxy in front of any shared endpoint.

Steps to set the Ollama host address:

  1. Choose the bind address and port.
    $ printf '%s\n' '0.0.0.0:11434'
    0.0.0.0:11434

    Use 127.0.0.1:11434 for local-only access.

  2. Test a foreground server with the new host value.
    $ OLLAMA_HOST=0.0.0.0:11434 ollama serve
    Listening on [::]:11434
  3. For Linux systemd, add OLLAMA_HOST to the service override.
    [Service]
    Environment="OLLAMA_HOST=0.0.0.0:11434"
  4. Reload and restart the service.
    $ sudo systemctl daemon-reload
    $ sudo systemctl restart ollama
  5. Check the API through the address clients will use.
    $ curl -s http://192.0.2.10:11434/api/version
    {"version":"0.31.1"}

    Use a firewall or proxy rule before exposing the port beyond trusted networks.