add reverse proxy docs

This commit is contained in:
Aine 2024-11-20 16:31:55 +02:00
parent 61b91adf25
commit dae6872fe8
No known key found for this signature in database
GPG key ID: 34969C908CCA2804
2 changed files with 55 additions and 24 deletions

View file

@ -220,29 +220,7 @@ You have three options:
- move or symlink the `synapse-admin` into your vhosts root dir - move or symlink the `synapse-admin` into your vhosts root dir
- open the url of the vhost in your browser - open the url of the vhost in your browser
**Example config for nginx:** [Reverse Proxy Documentation with Examples](./docs/reverse-proxy.md)
Place it in `/etc/nginx/conf.d/synapse-admin.conf` (don't forget to replace server_name and root)
```conf
server {
listen 80;
listen [::]:80;
server_name example.com; # REPLACE with your domain
root /var/www/synapse-admin; # REPLACE with path where you extracted synapse admin
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
location ~* \.(?:css|js|jpg|jpeg|gif|png|svg|ico|woff|woff2|ttf|eot|webp)$ {
expires 30d; # Set caching for static assets
add_header Cache-Control "public";
}
gzip on;
gzip_types text/plain application/javascript application/json text/css text/xml application/xml+rss;
gzip_min_length 1000;
}
```
#### Steps for 2) #### Steps for 2)
@ -302,7 +280,7 @@ services:
- /var/run/docker.sock:/var/run/docker.sock:ro - /var/run/docker.sock:/var/run/docker.sock:ro
synapse-admin: synapse-admin:
image: etkecc/synapse-admin:latest image: ghcr.io/etkecc/synapse-admin:latest
restart: unless-stopped restart: unless-stopped
labels: labels:
- "traefik.enable=true" - "traefik.enable=true"

53
docs/reverse-proxy.md Normal file
View file

@ -0,0 +1,53 @@
# Serving Synapse Admin behind a reverse proxy
Your are supposed to do so for any service you want to expose to the internet,
and here you can find specific instructions and example configurations for Synapse Admin.
## Nginx
Place the config below into `/etc/nginx/conf.d/synapse-admin.conf` (don't forget to replace `server_name` and `root`):
```nginx
server {
listen 80;
listen [::]:80;
server_name example.com; # REPLACE with your domain
root /var/www/synapse-admin; # REPLACE with path where you extracted synapse admin
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
location ~* \.(?:css|js|jpg|jpeg|gif|png|svg|ico|woff|woff2|ttf|eot|webp)$ {
expires 30d; # Set caching for static assets
add_header Cache-Control "public";
}
gzip on;
gzip_types text/plain application/javascript application/json text/css text/xml application/xml+rss;
gzip_min_length 1000;
}
```
After you've done that, ensure that the configuration is correct by running `nginx -t` and then reload Nginx
(e.g. `systemctl reload nginx`).
> **Note:** This configuration doesn't cover HTTPS, which is highly recommended to use. You can find more information
about setting up HTTPS in the [Nginx documentation](https://nginx.org/en/docs/http/configuring_https_servers.html).
## Traefik (docker labels)
If you are using Traefik as a reverse proxy, you can use the following labels, `docker-compose.yml` example:
```yaml
services:
synapse-admin:
image: ghcr.io/etkecc/synapse-admin:latest
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.synapse-admin.rule=Host(`example.com`)"
```
## Other reverse proxies
There is no examples for other reverse proxies yet, and so PRs are greatly appreciated.