Skip to content
Pocket Grove
App guides

Ollama Port 11434: Default URL, Changing It and Fixes

Published · 6 min read

Original research brief: . Sources reviewed: .

Looking for an app to help with this? Try Ollama Connect.

Quick answer: Ollama's default port is 11434. Out of the box it binds to 127.0.0.1:11434, so the default URL is http://localhost:11434, with the API at /api and the OpenAI-compatible API at /v1. To change the host or port, set OLLAMA_HOST (for example 0.0.0.0:11434 or 127.0.0.1:11500) and restart Ollama. "Connection refused" means nothing is listening at the address you used.

Most "Ollama port" questions come down to three things: what the address is, how to change it, and why a client cannot reach it. This guide answers each one with the commands from Ollama's own documentation.

What is the default Ollama port and URL?

Ollama's FAQ says it "binds 127.0.0.1 port 11434 by default". 127.0.0.1 is the loopback address. It means "this computer only". So by default, only programs on the same machine can talk to Ollama.

Ollama's API documentation lists these local base URLs:

What you want Local URL Notes
Native Ollama API http://localhost:11434/api Used by most Ollama clients
OpenAI-compatible API http://localhost:11434/v1 For tools that expect an OpenAI-style endpoint
Anthropic-style client http://localhost:11434 The client adds /v1/messages itself
Ollama cloud API https://ollama.com/api Needs an API key; local requests do not

The port is the same on macOS, Windows and Linux. The Windows guide also says the API "will be served on http://localhost:11434".

How do I check Ollama is running on port 11434?

Ask the server for its list of installed models (macOS or Linux terminal):

curl http://localhost:11434/api/tags

A JSON reply with a models list means Ollama is up and listening. If you see "connection refused", jump to the troubleshooting section below.

How do I change the Ollama port?

Ollama reads one setting for both the address and the port: the OLLAMA_HOST environment variable. An environment variable is a named setting that a program reads when it starts. Write it as address:port.

Two common values:

  • 127.0.0.1:11500: same computer only, but on port 11500.
  • 0.0.0.0:11434: listen on every network interface, so other devices on your network can connect.

The setting only takes effect when Ollama starts. Always restart it afterwards.

Change the port for a one-off test (macOS or Linux)

OLLAMA_HOST=127.0.0.1:11500 ollama serve

Leave that terminal open. In a second terminal, the ollama command also reads OLLAMA_HOST, so point it at the new port too:

OLLAMA_HOST=127.0.0.1:11500 ollama list

Make it permanent on the macOS app

The FAQ says that when Ollama runs as a macOS app, you set variables with launchctl and then restart the app:

launchctl setenv OLLAMA_HOST "0.0.0.0:11434"

Quit Ollama from the menu bar and open it again.

Make it permanent on Linux (systemd)

On Linux, Ollama usually runs as a systemd service. systemd is the Linux tool that starts background services. Open an override for the service:

sudo systemctl edit ollama.service

Add this under [Service]:

[Service]
Environment="OLLAMA_HOST=0.0.0.0:11434"

Then reload and restart:

sudo systemctl daemon-reload
sudo systemctl restart ollama

Change the port on Windows

The FAQ says Ollama on Windows inherits your user and system environment variables. The steps are:

  1. Quit Ollama by clicking its icon in the taskbar and choosing Quit.
  2. Open Edit environment variables for your account from Settings or Control Panel.
  3. Add or edit OLLAMA_HOST, for example 0.0.0.0:11434, then click OK.
  4. Start Ollama again from the Start menu.

If you only need one port and one machine, you can leave everything at the default. Changing the port is mainly useful when something else already uses 11434.

Fix "connection refused" on port 11434

"Connection refused" means your request reached the computer, but nothing was listening at that address and port. Work through these checks in order:

  • Is Ollama running? Open the app, or on Linux run sudo systemctl status ollama.
  • Is it on the port you expect? If you set OLLAMA_HOST to another port, your client must use that port too.
  • Are you using the right address? localhost on a phone or another PC means that device, not your Ollama computer. Use the computer's LAN IP, such as http://192.168.1.42:11434.
  • Is Ollama bound to localhost only? The default 127.0.0.1 refuses connections from other devices. Set OLLAMA_HOST=0.0.0.0:11434 and restart.
  • Did you restart after the change? An old Ollama process keeps its old address.

If the request times out instead of being refused, the usual cause is a firewall or a network that keeps devices apart. Our phone connection checklist walks through firewall and Wi-Fi checks, and the OLLAMA_HOST network guide covers the full LAN setup.

Fix "address already in use" or "port in use"

This error appears when you start ollama serve but another program already holds that port. Very often the other program is Ollama itself. If the desktop app or the Linux service is already running, it has already taken 127.0.0.1:11434, so a second ollama serve cannot.

You have two choices:

  1. Use the copy that is already running. Quit the app, or on Linux stop the service, before you start ollama serve by hand:

    sudo systemctl stop ollama
    
  2. Run the second copy on another port for testing:

    OLLAMA_HOST=127.0.0.1:11500 ollama serve
    

If neither helps, read the server log to see what failed. Ollama's troubleshooting page gives these locations:

# macOS
cat ~/.ollama/logs/server.log
# Linux (systemd)
journalctl -u ollama --no-pager --follow --pager-end
# Windows: opens the folder; read server.log
explorer %LOCALAPPDATA%\Ollama

Should I port-forward 11434?

No. Ollama's authentication page says the local API at http://localhost:11434 "does not require authentication". If you forward 11434 on your router, anyone on the internet who finds it can use your models and your hardware.

Keep the port on your home network. For access from outside, use a VPN or an SSH tunnel, which we cover in using Ollama away from home safely. If you run Ollama in a container, the Docker networking guide explains how ports map between the container and the host.

Using port 11434 from your phone

Once http://YOUR_COMPUTER_IP:11434/api/tags answers from another device, a phone client only needs that address. Ollama Connect is a chat client for your own Ollama host: you can search the local network for nearby servers or add the IP and port by hand, and its saved hosts show connection diagnostics. It is on iPhone and Android, and the Ollama Connect page explains what it does. Save the base address, not /api/tags; the app adds the API paths.

Related reading

Sources

Frequently asked questions

What is the default Ollama port?
Ollama listens on port 11434. By default it binds to 127.0.0.1, so only the same computer can reach it at http://localhost:11434.
What is the default Ollama API URL?
The native API is at http://localhost:11434/api and the OpenAI-compatible API is at http://localhost:11434/v1. Local requests do not need an API key.
How do I change the Ollama port?
Set the OLLAMA_HOST environment variable to a host and port, for example 127.0.0.1:11500, then restart Ollama. On a Mac app use launchctl, on Linux edit the systemd service, and on Windows edit your user environment variables and relaunch from the Start menu.
Why do I get connection refused on port 11434?
Nothing is listening at that address and port. Either Ollama is not running, it is listening on a different port, or it is bound to localhost while you are connecting from another device.
Should I open port 11434 on my router?
No. The local Ollama API has no authentication, so anyone who reaches the port can use your models. For access away from home, use a VPN or an SSH tunnel instead.

The app behind this guide

Ollama Connect

See the features and screenshots, or open the App Store from this guide.

Related guides