**Motivations:** - Expose Ollama and AnythingLLM via HTTPS paths on the LAN proxy with Bearer auth for Ollama. **Root causes:** - Cursor blocks direct requests to private IPs (SSRF policy). **Correctifs:** - N/A (new configuration artifacts). **Evolutions:** - Nginx site template, HTTP map for Bearer validation, websocket map example, deployment README, services doc link, feature documentation. **Pages affectées:** - deploy/nginx/http-maps/ia-enso-ollama-bearer.map.conf.example - deploy/nginx/http-maps/websocket-connection.map.conf.example - deploy/nginx/sites/ia.enso.4nkweb.com.conf - deploy/nginx/README-ia-enso.md - docs/features/ia-enso-nginx-proxy-ollama-anythingllm.md - docs/services.md
92 lines
2.8 KiB
Plaintext
92 lines
2.8 KiB
Plaintext
# ia.enso.4nkweb.com — reverse proxy to LAN host (Ollama + AnythingLLM).
|
|
#
|
|
# Prerequisites on the proxy host:
|
|
# - TLS certificate for ia.enso.4nkweb.com (e.g. certbot).
|
|
# - In the main nginx `http { }` block, include the Bearer map (see http-maps/ia-enso-ollama-bearer.map.conf.example).
|
|
#
|
|
# Upstream: adjust IA_ENSO_BACKEND_IP if the AI host IP changes.
|
|
|
|
upstream ia_enso_ollama {
|
|
server 192.168.1.164:11434;
|
|
keepalive 8;
|
|
}
|
|
|
|
upstream ia_enso_anythingllm {
|
|
server 192.168.1.164:3001;
|
|
keepalive 8;
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
server_name ia.enso.4nkweb.com;
|
|
|
|
location /.well-known/acme-challenge/ {
|
|
root /var/www/certbot;
|
|
}
|
|
|
|
location / {
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl;
|
|
http2 on;
|
|
server_name ia.enso.4nkweb.com;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/ia.enso.4nkweb.com/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/ia.enso.4nkweb.com/privkey.pem;
|
|
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_prefer_server_ciphers on;
|
|
ssl_session_cache shared:SSL:10m;
|
|
ssl_session_timeout 10m;
|
|
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
|
|
client_max_body_size 100M;
|
|
|
|
# Ollama OpenAI-compatible API: require Authorization: Bearer <shared secret> (see map file).
|
|
location /ollama/ {
|
|
if ($ia_enso_ollama_authorized = 0) {
|
|
return 401;
|
|
}
|
|
|
|
proxy_pass http://ia_enso_ollama/;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header Connection "";
|
|
|
|
# Ollama does not need the client Bearer; avoids passing the gate secret downstream.
|
|
proxy_set_header Authorization "";
|
|
|
|
proxy_buffering off;
|
|
proxy_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
}
|
|
|
|
# AnythingLLM UI + API (application login). Subpath stripped when forwarding.
|
|
location /anythingllm/ {
|
|
proxy_pass http://ia_enso_anythingllm/;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header X-Forwarded-Prefix /anythingllm;
|
|
proxy_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
}
|
|
|
|
location = /anythingllm {
|
|
return 301 https://$host/anythingllm/;
|
|
}
|
|
}
|