Make it possible to serve static websites from the base domain
This commit is contained in:
parent
1dd1f9602f
commit
810d0fb0e4
|
@ -12,7 +12,7 @@ Usually, there are 2 options:
|
||||||
|
|
||||||
- or, arrange for the Matrix server to serve the base domain. This either involves you [using your own webserver](configuring-playbook-own-webserver.md) or making the integrated webserver (`matrix-nginx-proxy`) serve the base domain for you.
|
- or, arrange for the Matrix server to serve the base domain. This either involves you [using your own webserver](configuring-playbook-own-webserver.md) or making the integrated webserver (`matrix-nginx-proxy`) serve the base domain for you.
|
||||||
|
|
||||||
We let you do the latter. With some easy changes, we make it possible to serve the base domain from the Matrix server via the integrated webserver (`matrix-nginx-proxy`).
|
This documentation page tells you how to do the latter. With some easy changes, we make it possible to serve the base domain from the Matrix server via the integrated webserver (`matrix-nginx-proxy`).
|
||||||
|
|
||||||
Just **adjust your DNS records**, so that your base domain is pointed to the Matrix server's IP address **and use the following configuration**:
|
Just **adjust your DNS records**, so that your base domain is pointed to the Matrix server's IP address **and use the following configuration**:
|
||||||
|
|
||||||
|
@ -26,4 +26,27 @@ Doing this, the playbook will:
|
||||||
|
|
||||||
- serve the `/.well-known/matrix/*` files which are necessary for [Federation Server Discovery](configuring-well-known.md#introduction-to-client-server-discovery) (also see [Server Delegation](howto-server-delegation.md)) and [Client-Server discovery](configuring-well-known.md#introduction-to-client-server-discovery)
|
- serve the `/.well-known/matrix/*` files which are necessary for [Federation Server Discovery](configuring-well-known.md#introduction-to-client-server-discovery) (also see [Server Delegation](howto-server-delegation.md)) and [Client-Server discovery](configuring-well-known.md#introduction-to-client-server-discovery)
|
||||||
|
|
||||||
- serve a simple homepage at `https://DOMAIN` with content `Hello from DOMAIN` (configurable via the `matrix_nginx_proxy_base_domain_homepage_template` variable)
|
- serve a simple homepage at `https://DOMAIN` with content `Hello from DOMAIN` (configurable via the `matrix_nginx_proxy_base_domain_homepage_template` variable). You can also [serve a more complicated static website](#serving-a-static-website-at-the-base-domain).
|
||||||
|
|
||||||
|
|
||||||
|
## Serving a static website at the base domain
|
||||||
|
|
||||||
|
By default, when "serving the base domain" is enabled, the playbook hosts a simple `index.html` webpage in `/matrix/nginx-proxy/data/matrix-domain`.
|
||||||
|
The content of this page is taken from the `matrix_nginx_proxy_base_domain_homepage_template` variable.
|
||||||
|
|
||||||
|
If you'd like to host your own static website (more than a single `index.html` page) at the base domain, you can disable the creation of this default `index.html` page like this:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
matrix_nginx_proxy_base_domain_homepage_enabled: false
|
||||||
|
```
|
||||||
|
|
||||||
|
With this configuration, Ansible will no longer mess around with the `/matrix/nginx-proxy/data/matrix-domain/index.html` file.
|
||||||
|
|
||||||
|
You are then free to upload any static website files to `/matrix/nginx-proxy/data/matrix-domain` and they will get served at the base domain.
|
||||||
|
|
||||||
|
|
||||||
|
## Serving a more complicated website at the base domain
|
||||||
|
|
||||||
|
If you'd like to serve an even more complicated (dynamic) website from the Matrix server, relying on the playbook to serve the base domain is not the best choice.
|
||||||
|
|
||||||
|
Instead, we recommend that you switch to [using your own webserver](configuring-playbook-own-webserver.md) (preferrably nginx). You can then make that webserver host anything you wish, and still easily plug in Matrix services into it.
|
||||||
|
|
|
@ -25,6 +25,7 @@ matrix_nginx_proxy_container_additional_volumes: []
|
||||||
# A list of extra arguments to pass to the container
|
# A list of extra arguments to pass to the container
|
||||||
matrix_nginx_proxy_container_extra_arguments: []
|
matrix_nginx_proxy_container_extra_arguments: []
|
||||||
|
|
||||||
|
|
||||||
# Controls whether matrix-nginx-proxy should serve the base domain.
|
# Controls whether matrix-nginx-proxy should serve the base domain.
|
||||||
#
|
#
|
||||||
# This is useful for when you only have your Matrix server, but you need to serve
|
# This is useful for when you only have your Matrix server, but you need to serve
|
||||||
|
@ -36,7 +37,17 @@ matrix_nginx_proxy_container_extra_arguments: []
|
||||||
# You can also put additional files to use for this webpage
|
# You can also put additional files to use for this webpage
|
||||||
# in the `{{ matrix_nginx_proxy_data_path }}/matrix-domain` (`/matrix/nginx-proxy/data/matrix-domain`) directory.
|
# in the `{{ matrix_nginx_proxy_data_path }}/matrix-domain` (`/matrix/nginx-proxy/data/matrix-domain`) directory.
|
||||||
matrix_nginx_proxy_base_domain_serving_enabled: false
|
matrix_nginx_proxy_base_domain_serving_enabled: false
|
||||||
|
|
||||||
matrix_nginx_proxy_base_domain_hostname: "{{ matrix_domain }}"
|
matrix_nginx_proxy_base_domain_hostname: "{{ matrix_domain }}"
|
||||||
|
|
||||||
|
# Controls whether `matrix_nginx_proxy_base_domain_homepage_template` would be dumped to an `index.html` file
|
||||||
|
# in the `/matrix/nginx-proxy/data/matrix-domain` directory.
|
||||||
|
#
|
||||||
|
# If you would instead like to serve a static website by yourself, you can disable this.
|
||||||
|
# When disabled, you're expected to put website files in `/matrix/nginx-proxy/data/matrix-domain` manually
|
||||||
|
# and can expect that the playbook won't intefere with the `index.html` file.
|
||||||
|
matrix_nginx_proxy_base_domain_homepage_enabled: true
|
||||||
|
|
||||||
matrix_nginx_proxy_base_domain_homepage_template: |-
|
matrix_nginx_proxy_base_domain_homepage_template: |-
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
|
@ -46,6 +57,7 @@ matrix_nginx_proxy_base_domain_homepage_template: |-
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
||||||
# Controls whether proxying the riot domain should be done.
|
# Controls whether proxying the riot domain should be done.
|
||||||
matrix_nginx_proxy_proxy_riot_enabled: false
|
matrix_nginx_proxy_proxy_riot_enabled: false
|
||||||
matrix_nginx_proxy_proxy_riot_hostname: "{{ matrix_server_fqn_riot }}"
|
matrix_nginx_proxy_proxy_riot_hostname: "{{ matrix_server_fqn_riot }}"
|
||||||
|
|
|
@ -82,7 +82,7 @@
|
||||||
mode: 0644
|
mode: 0644
|
||||||
owner: "{{ matrix_user_username }}"
|
owner: "{{ matrix_user_username }}"
|
||||||
group: "{{ matrix_user_username }}"
|
group: "{{ matrix_user_username }}"
|
||||||
when: matrix_nginx_proxy_base_domain_serving_enabled|bool
|
when: matrix_nginx_proxy_base_domain_serving_enabled|bool and matrix_nginx_proxy_base_domain_homepage_enabled|bool
|
||||||
|
|
||||||
- name: Ensure Matrix nginx-proxy configuration for base domain exists
|
- name: Ensure Matrix nginx-proxy configuration for base domain exists
|
||||||
template:
|
template:
|
||||||
|
|
Loading…
Reference in a new issue