> For the complete documentation index, see [llms.txt](https://docs.jianny.net/work/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.jianny.net/work/open-source/pending/matrix-synapse.md).

# Matrix/Synapse

Commands used

Still unsure about how to do reverse proxy 8448 or Federation part via Cloudflare tunnel method...

Of course, we [should not trust Cloudflare](https://write.pixie.town/thufie/dont-trust-cloudflare), after this experiment I will try with [Rathole](https://github.com/rapiz1/rathole), [SSH Punchhole](https://github.com/TamCore/ssh-punchhole),&#x20;

{% code overflow="wrap" %}

```bash
sudo apt install -y lsb-release wget apt-transport-https
sudo wget -O /usr/share/keyrings/matrix-org-archive-keyring.gpg https://packages.matrix.org/debian/matrix-org-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/matrix-org-archive-keyring.gpg] https://packages.matrix.org/debian/ $(lsb_release -cs) main"
sudo tee /etc/apt/sources.list.d/matrix-org.list
sudo apt update
sudo apt install matrix-synapse-py3
systemctl start matrix-synapse
systemctl enable matrix-synapse
systemctl status matrix-synapse
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
vi /etc/matrix-synapse/homeserver.yaml
# Add below lines
# registration_shared_secret: "<output from cat /dev/urandom above>"
# block_non_admin_invites: true
# limit_profile_requests_to_users_who_share_rooms: true
# allow_public_rooms_without_auth: true
# allow_guest_access: true
# Only do below once you confirmed https://servername returns correctly
# serve_server_wellknown: true

systemctl restart matrix-synapse

cloudflared.exe service install eyJhIjoiZjQ1NmM4Zjhj
curl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb &&  sudo dpkg -i cloudflared.deb &&  sudo cloudflared service install eyJhIjoiZjQ1NmM4Zjhj
sudo lsof -nP | grep LISTEN
# Check and open firewall ports
systemctl restart matrix-synapse

register_new_matrix_user -c /etc/matrix-synapse/homeserver.yaml http://localhost:8008
docker run -p 8080:80 awesometechnologies/synapse-admin
# Add 8080 into Cloudflare tunnel list for admin panel
```

{% endcode %}

{% embed url="<https://www.youtube.com/watch?v=TFDFR6EBG3k>" %}

{% embed url="<https://www.youtube.com/watch?v=-y8FE1Kta8c>" %}

{% embed url="<https://www.youtube.com/watch?v=YMj6nb-cm38>" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.jianny.net/work/open-source/pending/matrix-synapse.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
