-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnginx.conf
More file actions
68 lines (57 loc) · 2.22 KB
/
nginx.conf
File metadata and controls
68 lines (57 loc) · 2.22 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
# Gzip
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml;
upstream api {
server api:3000;
}
upstream qlever {
server qlever:7001;
}
server {
listen 80;
server_name _;
# ── REST API ──────────────────────────────────────────────────────
location /api/ {
proxy_pass http://api;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# ── SPARQL endpoint (public read via API proxy) ───────────────────
# The API service proxies /sparql → QLever with optional auth
location /sparql {
proxy_pass http://api/sparql;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
# ── OpenAPI docs ──────────────────────────────────────────────────
location ^~ /api/v1/docs {
proxy_pass http://api/api/v1/docs;
proxy_set_header Host $host;
}
# ── React SPA (catch-all) ─────────────────────────────────────────
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
expires 1h;
add_header Cache-Control "public, must-revalidate";
}
# Static assets with long cache
location ~* \.(js|css|woff2?|png|svg|ico)$ {
root /usr/share/nginx/html;
expires 1y;
add_header Cache-Control "public, immutable";
}
}
}