Newsletter
TechAnV Blog
Get updates on security engineering, Rust, eBPF, and DevSecOps. No spam, unsubscribe anytime.
Check your inbox and click the confirmation link to complete your subscription.
Using nginx to proxy to a Unix domain socket#
I figured this out while adding --uds support to Datasette in #1388. Save the following in nginx.conf:
1daemon off;2events {3 worker_connections 1024;4}5http {6 server {7 listen 8092;8 location / {9 proxy_pass http://datasette;10 proxy_set_header Host $host;11 }12 }13 upstream datasette {14 server unix:/tmp/datasette.sock;15 }16}Start nginx against that configuration file - this works without root provided you listen on a high port:
1nginx -c $PWD/nginx.conf(The $PWD seems necessary to avoid nginx looking in its default directory.)
Start something listening on the /tmp/datasette.sock path - with the latest Datasette you can do this:
1datasette --uds /tmp/datasette.sockNow hits to http://localhost:8092/ will proxy through to Datasette.
Newsletter
TechAnV Blog
Get updates on security engineering, Rust, eBPF, and DevSecOps. No spam, unsubscribe anytime.
Check your inbox and click the confirmation link to complete your subscription.