Skip to content

Instantly share code, notes, and snippets.

@keyboardcrunch
Created September 25, 2024 00:29
Show Gist options
  • Save keyboardcrunch/f42b776dc86ebd480f962043a9525444 to your computer and use it in GitHub Desktop.
Save keyboardcrunch/f42b776dc86ebd480f962043a9525444 to your computer and use it in GitHub Desktop.
Nginx proxy Ollama load balancer
# Listen on 11434 and proxy requests to a local Ollama server, either by local network or tailscale.
# ip_hash should maintain sessions while upstream handles one being offline.
# upstream 'load balancing' is used to maintain connectivity while working remote.
upstream ollama {
ip_hash;
server 192.168.1.166:11434;
server 100.94.79.62:11434;
}
server {
listen 11434;
location / {
proxy_set_header Host ollama;
proxy_pass http://ollama;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment