From a5a2adf1ec18f8ee574378a8ccb54230f79ee997 Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Tue, 24 Oct 2023 10:54:16 -0700 Subject: [PATCH 1/2] update faq --- docs/faq.md | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/docs/faq.md b/docs/faq.md index 2840b898..0b44ce3b 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -18,16 +18,44 @@ If you're running `ollama serve` directly, the logs will be printed to the conso ## How can I expose the Ollama server? +Ollama binds to 127.0.0.1 port 11434 by default. Change the bind address with the `OLLAMA_HOST` environment variable. + +Ollama allows cross origin requests from `127.0.0.1` and `0.0.0.0` by default. Add additional origins with the `OLLAMA_ORIGINS` environment variable: + +On macOS: + ```bash OLLAMA_HOST=0.0.0.0:11435 ollama serve ``` -By default, Ollama allows cross origin requests from `127.0.0.1` and `0.0.0.0`. To support more origins, you can use the `OLLAMA_ORIGINS` environment variable: - ```bash OLLAMA_ORIGINS=http://192.168.1.1:*,https://example.com ollama serve ``` +On Linux: + +Create a `systemd` drop-in directory and set `Environment=OLLAMA_HOST` and/or `Environment=OLLAMA_ORIGINS` + +```bash +mkdir -p /etc/systemd/system/ollama.service.d +echo "[Service]" >>/etc/systemd/system/ollama.service.d/environment.conf +``` + +```bash +echo "Environment=OLLAMA_HOST=0.0.0.0:11434" >>/etc/systemd/system/ollama.service.d/environment.conf +``` + +```bash +echo "Environment=OLLAMA_HOST=http://129.168.1.1:*,https://example.com" >>/etc/systemd/system/ollama.service.d/environment.conf +``` + +Reload `systemd` and restart Ollama. + +```bash +systemctl daemon-reload +systemctl restart ollama +``` + ## Where are models stored? - macOS: Raw model data is stored under `~/.ollama/models`. From db342691f9e9f4ca1124a5bd115099fd75382b7f Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Tue, 24 Oct 2023 13:59:33 -0700 Subject: [PATCH 2/2] Update docs/faq.md Co-authored-by: Bruce MacDonald --- docs/faq.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/faq.md b/docs/faq.md index 0b44ce3b..2c7711d5 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -46,7 +46,7 @@ echo "Environment=OLLAMA_HOST=0.0.0.0:11434" >>/etc/systemd/system/ollama.servic ``` ```bash -echo "Environment=OLLAMA_HOST=http://129.168.1.1:*,https://example.com" >>/etc/systemd/system/ollama.service.d/environment.conf +echo "Environment=OLLAMA_ORIGINS=http://129.168.1.1:*,https://example.com" >>/etc/systemd/system/ollama.service.d/environment.conf ``` Reload `systemd` and restart Ollama.