mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
--uds option for binding to Unix domain socket, closes #1388
This commit is contained in:
parent
e0064ba7b0
commit
180c7a5328
6 changed files with 65 additions and 2 deletions
|
|
@ -12,6 +12,7 @@ Options:
|
|||
machines.
|
||||
-p, --port INTEGER RANGE Port for server, defaults to 8001. Use -p 0 to automatically
|
||||
assign an available port. [0<=x<=65535]
|
||||
--uds TEXT Bind to a Unix domain socket
|
||||
--reload Automatically reload if code or metadata change detected -
|
||||
useful for development
|
||||
--cors Enable CORS by serving Access-Control-Allow-Origin: *
|
||||
|
|
|
|||
|
|
@ -148,7 +148,6 @@ Here is an example of an `nginx <https://nginx.org/>`__ configuration file that
|
|||
http {
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
location /my-datasette {
|
||||
proxy_pass http://127.0.0.1:8009/my-datasette;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
|
@ -157,6 +156,28 @@ Here is an example of an `nginx <https://nginx.org/>`__ configuration file that
|
|||
}
|
||||
}
|
||||
|
||||
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 / {
|
||||
proxy_pass http://datasette;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
}
|
||||
upstream datasette {
|
||||
server unix:/tmp/datasette.sock;
|
||||
}
|
||||
}
|
||||
|
||||
Then run Datasette with ``datasette --uds /tmp/datasette.sock path/to/database.db``.
|
||||
|
||||
Apache proxy configuration
|
||||
--------------------------
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue