[GH-ISSUE #3061] How to specify a port number for ollama serve? #27644

Closed
opened 2026-04-22 05:08:03 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @soonhokong on GitHub (Mar 11, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/3061

Is there a way to specify a different port number (other than 11434) when I start ollama serve?

Originally created by @soonhokong on GitHub (Mar 11, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/3061 Is there a way to specify a different port number (other than 11434) when I start `ollama serve`?
Author
Owner

@angel1254mc commented on GitHub (Mar 11, 2024):

Based on the FAQ and this chunk of code, it looks like you can set a local environment variable OLLAMA_HOST to something like http://localhost:YOUR_PORT_HERE to specify the port you want the server listening on.

<!-- gh-comment-id:1989302646 --> @angel1254mc commented on GitHub (Mar 11, 2024): Based on the [FAQ](https://github.com/ollama/ollama/blob/f878e91070af750709f1b3195eeb9fbdcaad2bef/docs/faq.md?plain=1#L39-L42) and [this chunk of code](https://github.com/ollama/ollama/blob/f878e91070af750709f1b3195eeb9fbdcaad2bef/api/client.go#L46-L59), it looks like you can set a local environment variable `OLLAMA_HOST` to something like `http://localhost:YOUR_PORT_HERE` to specify the port you want the server listening on.
Author
Owner

@soonhokong commented on GitHub (Mar 11, 2024):

Got it. Thanks!

<!-- gh-comment-id:1989420626 --> @soonhokong commented on GitHub (Mar 11, 2024): Got it. Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#27644