Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation on serving Datasette behind a proxy using base_url #1027

Closed
simonw opened this issue Oct 15, 2020 · 5 comments
Closed

Add documentation on serving Datasette behind a proxy using base_url #1027

simonw opened this issue Oct 15, 2020 · 5 comments
Milestone

Comments

@simonw
Copy link
Owner

simonw commented Oct 15, 2020

This can go on this page: https://docs.datasette.io/en/stable/deploying.html

Refs #1023, #865

@simonw
Copy link
Owner Author

simonw commented Oct 15, 2020

It should cover both nginx and Apache. nginx config is here: #1024 (comment)

@simonw
Copy link
Owner Author

simonw commented Oct 15, 2020

I'll install Apache on macOS to figure this out using https://formulae.brew.sh/formula/httpd

brew install httpd output this at the end:

==> httpd
DocumentRoot is /usr/local/var/www.

The default ports have been set in /usr/local/etc/httpd/httpd.conf to 8080 and in
/usr/local/etc/httpd/extra/httpd-ssl.conf to 8443 so that httpd can run without sudo.

To have launchd start httpd now and restart at login:
  brew services start httpd
Or, if you don't want/need a background service you can just run:
  apachectl start

@simonw
Copy link
Owner Author

simonw commented Oct 17, 2020

Running apachectl -X appears to run Apache in the foreground so I can hit Ctrl+C to quit it again, using the config file at /usr/local/etc/httpd/httpd.conf and serving the index.html file from /usr/local/var/www (which confusingly says "Welcome to nginx", presumably because I installed nginx via Homebrew earlier).

@simonw
Copy link
Owner Author

simonw commented Oct 19, 2020

Still need to configure proxying though. https://www.netnea.com/cms/apache-tutorial-9_setting-up-a-reverse-proxy/

@simonw simonw added this to the 0.51 milestone Oct 23, 2020
@simonw
Copy link
Owner Author

simonw commented Oct 31, 2020

On my Mac, I run:

datasette . -p 8009 --config base_url:/datasette-prefix/

Then I edited /usr/local/etc/httpd/httpd.conf and add this section:

LoadModule proxy_module lib/httpd/modules/mod_proxy.so
LoadModule proxy_http_module lib/httpd/modules/mod_proxy_http.so
ProxyPass          /datasette-prefix/    http://localhost:8009/datasette-prefix/

I ran Apache in the foreground like so:

apachectl -X

Now hitting http://localhost:8081/datasette-prefix/fixtures/compound_three_primary_keys worked!

@simonw simonw closed this as completed in 1fe15f4 Oct 31, 2020
simonw added a commit that referenced this issue Oct 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant