Files
jarvis-lan/nginx.conf
2025-12-28 04:27:26 +01:00

81 lines
2.3 KiB
Nginx Configuration File

server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# Favicon
location = /favicon.ico {
try_files /favicon.ico =204;
access_log off;
log_not_found off;
}
location = style.css {
try_files /style.css =204;
}
location = chatv2.js {
try_files /chatv2.js =204;
}
# Custom 404 page
error_page 404 /404.html;
location = /404.html {
internal;
}
# Enable clean URLs without .html extension
location / {
# Try the exact URI, then with .html, then as directory with index.html, then 404
try_files $uri $uri.html $uri/ =404;
}
location = /index.html {
try_files /index.html =404;
}
# Proxy API requests to plato.lan (192.168.1.74)
location /api/plato/ {
proxy_pass http://192.168.1.74:1234/v1/;
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 API requests to stoic.lan (192.168.1.159)
location /api/stoic/ {
proxy_pass http://192.168.1.159:1234/v1/;
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 API requests to ollama (192.168.1.159:8081)
location /api/ollama/ {
proxy_pass http://192.168.1.159:8081/v1/;
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;
}
# Default /api/ points to plato for backwards compatibility
location /api/ {
proxy_pass http://192.168.1.74:1234/v1/;
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;
}
# Gzip compression for better performance
gzip on;
gzip_vary on;
gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/json;
}