81 lines
3.6 KiB
Plaintext
81 lines
3.6 KiB
Plaintext
# /etc/nginx/sites-available/audiocontrol
|
|
# Symlink: ln -s /etc/nginx/sites-available/audiocontrol /etc/nginx/sites-enabled/
|
|
#
|
|
# Edit BEOCREATE_HOST to match your BeoCreate Pi's hostname or IP.
|
|
|
|
upstream beocreate { server beocreate.local:5005; } # ← change if needed
|
|
upstream mopidy { server 127.0.0.1:6680; }
|
|
upstream snapcast { server 127.0.0.1:1705; }
|
|
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
# ── Serve React build ────────────────────────────────────────────────────
|
|
root /var/www/audiocontrol;
|
|
index index.html;
|
|
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# ── HiFiBerry DSP REST API (BeoCreate Pi) ────────────────────────────────
|
|
# Proxied: /api/hifiberry/* → http://beocreate:5005/api/*
|
|
location /api/hifiberry/ {
|
|
proxy_pass http://beocreate/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;
|
|
proxy_read_timeout 10s;
|
|
}
|
|
|
|
# ── Mopidy JSON-RPC (HTTP) ───────────────────────────────────────────────
|
|
# Proxied: /api/mopidy/rpc → http://localhost:6680/mopidy/rpc
|
|
location /api/mopidy/ {
|
|
proxy_pass http://mopidy/mopidy/;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_read_timeout 10s;
|
|
}
|
|
|
|
# ── Mopidy library images ───────────────────────────────────────────────
|
|
location /api/mopidy-image/ {
|
|
proxy_pass http://mopidy/;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_read_timeout 10s;
|
|
}
|
|
|
|
# ── Mopidy WebSocket ─────────────────────────────────────────────────────
|
|
# Used for real-time playback events
|
|
location /ws/mopidy {
|
|
proxy_pass http://mopidy/mopidy/ws;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
proxy_set_header Host $host;
|
|
proxy_read_timeout 86400s; # keep WS alive
|
|
proxy_send_timeout 86400s;
|
|
}
|
|
|
|
# ── Snapcast JSON-RPC WebSocket ──────────────────────────────────────────
|
|
# Snapcast serves its JSON-RPC protocol directly over WebSocket on :1705
|
|
location /ws/snapcast {
|
|
proxy_pass http://snapcast/;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
proxy_set_header Host $host;
|
|
proxy_read_timeout 86400s;
|
|
proxy_send_timeout 86400s;
|
|
}
|
|
|
|
# ── Snapcast now playing recognition ─────────────────────────────────────
|
|
location /api/now-playing/ {
|
|
proxy_pass http://127.0.0.1:8090/;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_read_timeout 45s;
|
|
}
|
|
}
|