sections: deploying:nginx-proxy-configuration
This data as json
id | page | ref | title | content | breadcrumbs | references |
---|---|---|---|---|---|---|
deploying:nginx-proxy-configuration | deploying | nginx-proxy-configuration | Nginx proxy configuration | Here is an example of an nginx configuration file that will proxy traffic to Datasette: daemon off; events { worker_connections 1024; } http { server { listen 80; location /my-datasette { proxy_pass http://127.0.0.1:8009/my-datasette; proxy_set_header Host $host; } } } You can also use the --uds option to Datasette to listen on a Unix domain socket instead of a port, configuring the nginx upstream proxy like this: daemon off; events { worker_connections 1024; } http { server { listen 80; location /my-datasette { proxy_pass http://datasette/my-datasette; proxy_set_header Host $host; } } upstream datasette { server unix:/tmp/datasette.sock; } } Then run Datasette with datasette --uds /tmp/datasette.sock path/to/database.db --setting base_url /my-datasette/ . | ["Deploying Datasette", "Running Datasette behind a proxy"] | [{"href": "https://nginx.org/", "label": "nginx"}] |