diff options
author | Alex Auvolat <alex@adnab.me> | 2022-02-02 10:07:26 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-02-02 10:07:26 +0100 |
commit | f5afa3d974e631de75c438cf2941a88440e2cf69 (patch) | |
tree | 9f9a89d10940757025b82ff8fdfbe3104c5f89a4 /content/documentation/cookbook/exposing_websites.md | |
parent | 921dd28f7499e46d78bd39d9ac7630efc50b64e8 (diff) | |
download | garagehq.deuxfleurs.fr-f5afa3d974e631de75c438cf2941a88440e2cf69.tar.gz garagehq.deuxfleurs.fr-f5afa3d974e631de75c438cf2941a88440e2cf69.zip |
Documentation from garage submodule
Diffstat (limited to 'content/documentation/cookbook/exposing_websites.md')
-rw-r--r-- | content/documentation/cookbook/exposing_websites.md | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/content/documentation/cookbook/exposing_websites.md b/content/documentation/cookbook/exposing_websites.md deleted file mode 100644 index 1594ccc..0000000 --- a/content/documentation/cookbook/exposing_websites.md +++ /dev/null @@ -1,51 +0,0 @@ -+++ -title = "Exposing buckets as websites" -weight = 25 -+++ - -You can expose your bucket as a website with this simple command: - -```bash -garage bucket website --allow my-website -``` - -Now it will be **publicly** exposed on the web endpoint (by default listening on port 3902). - -Our website serving logic is as follow: - - Supports only static websites (no support for PHP or other languages) - - Does not support directory listing - - The index is defined in your `garage.toml`. ([ref](/documentation/reference-manual/configuration/#garage-configuration-file-format-reference)) - -Now we need to infer the URL of your website through your bucket name. -Let assume: - - we set `root_domain = ".web.example.com"` in `garage.toml` ([ref](/documentation/reference-manual/configuration/#garage-configuration-file-format-reference)) - - our bucket name is `garagehq.deuxfleurs.fr`. - -Our bucket will be served if the Host field matches one of these 2 values (the port is ignored): - - - `garagehq.deuxfleurs.fr.web.example.com`: you can dedicate a subdomain to your users (here `web.example.com`). - - - `garagehq.deuxfleurs.fr`: your users can bring their own domain name, they just need to point them to your Garage cluster. - -You can try this logic locally, without configuring any DNS, thanks to `curl`: - -```bash -# prepare your test -echo hello world > /tmp/index.html -mc cp /tmp/index.html garage/garagehq.deuxfleurs.fr - -curl -H 'Host: garagehq.deuxfleurs.fr' http://localhost:3902 -# should print "hello world" - -curl -H 'Host: garagehq.deuxfleurs.fr.web.example.com' http://localhost:3902 -# should also print "hello world" -``` - -Now that you understand how website logic works on Garage, you can: - - - make the website endpoint listens on port 80 (instead of 3902) - - use iptables to redirect the port 80 to the port 3902: - `iptables -t nat -A PREROUTING -p tcp -dport 80 -j REDIRECT -to-port 3902` - - or configure a [reverse proxy](/documentation/cookbook/reverse-proxy/) in front of Garage to add TLS (HTTPS), CORS support, etc. - -You can also take a look at [Website Integration](/documentation/connect/websites/) to see how you can add Garage to your workflow. |