CARVIEW |
Select Language
HTTP/2 200
date: Sun, 12 Oct 2025 14:49:36 GMT
server: Fly/6f91d33b9d (2025-10-08)
content-type: text/html; charset=utf-8
content-encoding: gzip
via: 2 fly.io, 2 fly.io
fly-request-id: 01K7CEC187SMGQFTEAR600JVW3-bom
Using nginx to proxy to a Unix domain socket | Simon Willison’s TILs
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
:
daemon off;
events {
worker_connections 1024;
}
http {
server {
listen 8092;
location / {
proxy_pass https://datasette;
proxy_set_header Host $host;
}
}
upstream datasette {
server unix:/tmp/datasette.sock;
}
}
Start nginx
against that configuration file - this works without root provided you listen on a high port:
nginx -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:
datasette --uds /tmp/datasette.sock
Now hits to https://localhost:8092/
will proxy through to Datasette.
Related
- datasette Running Datasette on Replit - 2021-05-02
- digitalocean Running Datasette on DigitalOcean App Platform - 2020-10-06
- django Adding a Datasette ASGI app to Django - 2022-10-20
- kubernetes Basic Datasette in Kubernetes - 2021-11-05
- pytest Start a server in a subprocess during a pytest session - 2020-08-31
- fly Assigning a custom subdomain to a Fly app - 2021-11-20
- github Setting up a custom subdomain for a GitHub Pages site - 2022-05-04
- datasette Using pytest-httpx to run intercepted requests through an in-memory Datasette instance - 2023-07-24
- caddy Pausing traffic and retrying in Caddy - 2021-11-24
- cloudflare How to get Cloudflare to cache HTML - 2024-01-08
Created 2021-07-10T18:12:03-07:00 · Edit