-
Notifications
You must be signed in to change notification settings - Fork 17
/
nginx-ollama.conf
40 lines (34 loc) · 1.46 KB
/
nginx-ollama.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
server {
#if you have ollama on another server on internet, not in your local network,
#don't forget to configure SSL so your chats are not sent in open text over http
#if it's on your own computer, it's not important.
listen 80;
server_name 127.0.0.1;
access_log /var/log/nginx/snake_futurestud_io_access.log;
error_log /var/log/nginx/snake_futurestud_io_error.log;
root /var/www/html/;
index index.html;
location / {
try_files $uri $uri/ =404;
}
#change this to IP that is allowed to access ollama. that should be your own IP.
#if you run on your local computer, then leave it as is.
allow 127.0.0.1;
deny all;
#this is reverse proxy configuration, to allow accessing ollama from other computers.
#access is allowed only to the IPs above. by default, only to the local computer.
location /ollama_proxy {
rewrite /ollama_proxy(.+) $1 break;
proxy_hide_header 'Origin';
add_header 'Origin' 'http://127.0.0.1'; #should be ip of the server where ollama is
proxy_pass http://127.0.0.1:11434; #should be ip:port of the server where ollama is
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_cache_bypass $http_upgrade;
proxy_read_timeout 3600;
proxy_connect_timeout 3600;
proxy_send_timeout 3600;
}
}