Ollama Private Deployment and Team Deployment
A single server with a GPU can become a shared model service for the entire team: container orchestration, intranet sharing, reverse proxying, and model distribution--this article pieces these together into a complete team deployment solution.
Establish the key understanding first: Ollama itself has no authentication mechanism, so the security boundary must be built with reverse proxies and network policies.
Overview of team deployment topology
The recommended standard topology is three-tier: member traffic first reaches the reverse proxy, which forwards it after authentication to the Ollama service that listens only on the local loopback.
The key design of this structure is that Ollama listens only on 127.0.0.1, all external access must go through the proxy, making the authentication entry point unique and controllable.
Docker and Compose orchestration
Docker is the first choice for server deployment; team scenarios use Compose to solidify the configuration:
# File path: docker-compose.yml
services:
ollama:
image: ollama/ollama # AMD 显卡改用 ollama/ollama:rocm
container_name: ollama
restart: unless-stopped
volumes:
- ollama:/root/.ollama # 模型持久化,升级镜像不丢模型
ports:
- "127.0.0.1:11434:11434" # 只暴露给本机,交给 Nginx 对外
# NVIDIA GPU Passthrough (requires NVIDIA Container Toolkit to be installed first)
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
volumes:
ollama:
docker-related commands:
# Start / View Logs / Upgrade
docker compose up -d
docker compose logs -f ollama
docker compose pull && docker compose up -d
Note that the ports mapping is written as 127.0.0.1:11434:11434 rather than 11434:11434: the former restricts the port to the local loopback, so external access is only via Nginx; the latter is equivalent to exposing the unauthenticated service directly on the network interface, which is the most common source of team security incidents.
Sharing one model server on the LAN
When a small team doesn't want to set up a proxy, the lowest-cost sharing method is to have Ollama listen directly on the intranet:
# Server-side: listen on all network interfaces
OLLAMA_HOST=0.0.0.0:11434 ollama serve
On member machines, point OLLAMA_HOST to the server, and the local ollama command will operate the remote service:
# Member computer: CLI and SDK both recognize this variable
export OLLAMA_HOST=http://192.168.1.100:11434
# All subsequent commands will operate on the server
ollama run qwen3.5
Capacity planning for multi-user sharing directly references the formula from the configuration chapter: the number of concurrent requests multiplied by the context length determines VRAM usage; a 10-person team is advised not to set NUM_PARALLEL to 10, as queuing is often more graceful than exhausting VRAM.
Reverse proxy and tunneling
Nginx reverse proxy (recommended)
# File path: /etc/nginx/conf.d/ollama.conf
server {
listen 80;
server_name model.example.com; # 换成你的域名或内网 IP
location / {
proxy_pass http://localhost:11434;
proxy_set_header Host localhost:11434;
# Ollama streaming response is NDJSON, suggest disabling buffering to avoid "stuttering"
proxy_buffering off;
}
}
Temporary tunnels: ngrok and Cloudflare Tunnel
For demos and remote joint debugging, tunnels can temporarily expose a local service to the public internet:
# ngrok
ngrok http 11434 --host-header="localhost:11434"
# Cloudflare Tunnel
cloudflared tunnel --url http://localhost:11434 --http-host-header="localhost:11434"
A tunnel is equivalent to opening an unauthenticated service to the public internet; it is only recommended for short-term demos and should be closed immediately after use; for long-term external access, use the authenticated Nginx solution.
Authentication: build the security boundary yourself
Ollama has no built-in account system, so team deployments must build their own authentication; three common approaches:
| Solution | Approach | Applicable |
|---|---|---|
| Nginx Basic Auth | htpasswd generates a password file, verified centrally at the proxy layer | Small teams, up and running in ten minutes |
| API gateway | Gateways such as Kong and APISIX handle API Key issuance, rate limiting, and auditing | Multi-team sharing, requires metering |
| Network isolation | Ollama only on the intranet or VPN network segment, not exposed to the public internet | Environments with enterprise network controls |
Taking the most common Nginx Basic Auth as an example:
# Generate password file
sudo htpasswd -c /etc/nginx/.htpasswd zhangsan
# Add two lines in the Nginx location block:
# auth_basic "Ollama API";
# auth_basic_user_file /etc/nginx/.htpasswd;
The above authentication solutions come from common community practice rather than official Ollama features; choose according to your team's existing infrastructure, with one principle: never expose 11434 directly to an untrusted network.
Distribution and version management of private models
A well-customized team model needs a distribution mechanism; Ollama's approach is namespaces plus push.
The process has four steps: register an ollama.com account; bind your local public key (~/.ollama/id_ed25519.pub) on the official website's settings page; copy the model to a name with your username; push.
# Copy to a namespaced name, use tag to mark version
ollama cp runoob-helper myteam/runoob-helper:v1
# Push to ollama.com
ollama push myteam/runoob-helper:v1
# Member retrieval usage (requires login for private models)
ollama run myteam/runoob-helper:v1
Version management uses tags: v1 and v2 are independent, and rolling back simply means switching back to the old tag.
A fully offline intranet alternative also exists: place the customized Modelfile and weight files in an internal code repository or file service, and members build locally with create. Ollama currently does not provide a server for a self-hosted private registry, so cross-network distribution mainly takes these two forms.
Monitoring and operations
Daily operations of a self-hosted service revolve around three things: the service is alive, resources are sufficient, and errors are traceable.
The official handles provided are ollama ps (model loading and VRAM), logs (see the summary table in the configuration chapter for locations), and the API's usage field (token-level timing statistics).
Community solutions fill in metrics-based monitoring: the open-source Ollama exporter can expose metrics such as request counts and token throughput to Prometheus, with Grafana for dashboards. When needs are simple, a script that periodically polls /api/ps and alerts on log keywords is sufficient.
Monitoring solutions are mostly community-maintained, so confirm the Ollama versions they support before choosing; this article does not lock in specific project names--building your own with the "metrics exposure - time-series database - dashboard" trio is also fine.
Introduction to Kubernetes deployment
Teams with existing K8s infrastructure can run Ollama in the cluster using a Deployment, with three key points: persist model data with a PVC, declare resource scheduling for GPU nodes, and expose the service via an in-cluster Service.
# Skeleton sketch: Deployment + GPU resource declaration
apiVersion: apps/v1
kind: Deployment
metadata:
name: ollama
spec:
replicas: 1
template:
spec:
containers:
- name: ollama
image: ollama/ollama
ports:
- containerPort: 11434
volumeMounts:
- name: models # 模型持久化,避免 Pod 重建重新拉取
mountPath: /root/.ollama
resources:
limits:
nvidia.com/gpu: 1 # 声明 GPU,配合集群 GPU 调度
volumes:
- name: models
persistentVolumeClaim:
claimName: ollama-models
Ollama has no officially published Helm Chart, so cluster deployments mostly rely on community Charts or self-authored manifests; the benefit of K8s lies mainly in scheduling and self-healing; if you only have one GPU server, Docker Compose is usually the more worry-free choice.