[GH-ISSUE #9579] 怎么将ollama的监听端口绑定到0.0.0.0 #32008

Closed
opened 2026-04-22 12:53:14 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @Yxj-study on GitHub (Mar 7, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/9579

Ollama 服务只绑定到了 127.0.0.1:11434(即本地回环地址),我想更改绑定

Originally created by @Yxj-study on GitHub (Mar 7, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/9579 Ollama 服务只绑定到了 127.0.0.1:11434(即本地回环地址),我想更改绑定
GiteaMirror added the question label 2026-04-22 12:53:14 -05:00
Author
Owner
<!-- gh-comment-id:2706469441 --> @rick-github commented on GitHub (Mar 7, 2025): https://github.com/ollama/ollama/blob/main/docs/faq.md#how-can-i-expose-ollama-on-my-network
Author
Owner

@mikestut commented on GitHub (Mar 8, 2025):

Edit the systemd service by calling systemctl edit ollama.service. This will open an editor.

For each environment variable, add a line Environment under section [Service]:

[Service]
Environment="OLLAMA_HOST=0.0.0.0:11434"
Save and exit.

Reload systemd and restart Ollama:

systemctl daemon-reload
systemctl restart ollama

<!-- gh-comment-id:2708377221 --> @mikestut commented on GitHub (Mar 8, 2025): Edit the systemd service by calling systemctl edit ollama.service. This will open an editor. For each environment variable, add a line Environment under section [Service]: [Service] Environment="OLLAMA_HOST=0.0.0.0:11434" Save and exit. Reload systemd and restart Ollama: systemctl daemon-reload systemctl restart ollama
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#32008