Unable to Connect n8n to Local Ollama Instance (ECONNREFUSED Error)

If you want ollama to listen on all network devices on your machine then you’ll need to set the following environment variable:

export OLLAMA_HOST="0.0.0.0"

Then just start ollama with: ollama serve.

There is a nice FAQ how to run ollama as a server instance: ollama/docs/faq.md at main · ollama/ollama · GitHub

Also if your ollama server is behind a firewall (NAT etc) you’ll need to portforward the port from your firewall/router to your machine.

2 Likes