LIVEReading: Self-Host Element Web: Your Own Matrix Chat ClientTotal time: 12 minSteps: 6Worked first time: 72% LIVEReading: Self-Host Element Web: Your Own Matrix Chat ClientTotal time: 12 minSteps: 6Worked first time: 72%
CBW
Self-Host Element Web: Your Own Matrix Chat Client
Mediumgithub.com/element-hq/element-web2026-07-09

Self-Host Element Web: Your Own Matrix Chat Client

Run your own copy of Element, the polished Matrix messaging client, on a web server using Docker. No coding required — just a few commands and a config file.

// Build stats

  • Total time12 min
  • Number of steps6
  • DifficultyMedium
  • Worked first time72%
// Before you start

What you need

  • A Linux server or VPS (Ubuntu 22.04 recommended)
  • Docker installed on that server
  • A domain name or subdomain pointed at your server (optional but recommended)
  • A Matrix account or homeserver to connect to (e.g. matrix.org works fine)
  • Basic comfort running commands in a terminal over SSH
01
Step 1 of 6

Confirm Docker is ready

2 min

Before anything else, make sure Docker is installed and running. This single command prints the version if Docker is ready. If you get an error, install Docker first via https://docs.docker.com/engine/install/ubuntu/.

Terminal · mac
$ docker --version
What you should see
Docker version 24.x.x, build xxxxxxx
This might happen

Permission denied when running docker

Run: sudo usermod -aG docker $USER — then log out and back in.

02
Step 2 of 6

Create a working folder

1 min

Make a dedicated folder to keep your Element config files tidy. All the next steps happen inside this folder.

Terminal · mac
$ mkdir ~/element-web && cd ~/element-web
What you should see
No output. Your terminal prompt now shows the new folder path.
03
Step 3 of 6

Create the config file

5 min

Element needs a small JSON config file to know which Matrix homeserver to point at by default. The command below creates a minimal working config that points to matrix.org. If you run your own homeserver, replace 'matrix.org' with your homeserver domain in both places. The file must be named config.json.

Terminal · mac
$ cat > config.json << 'EOF'
$ {
$ "default_server_config": {
$ "m.homeserver": {
$ "base_url": "https://matrix.org",
$ "server_name": "matrix.org"
$ }
$ },
$ "brand": "Element",
$ "integrations_ui_url": "https://scalar.vector.im/",
$ "integrations_rest_url": "https://scalar.vector.im/api",
$ "bug_report_endpoint_url": "https://element.io/bugreports/submit",
$ "showLabsSettings": true
$ }
$ EOF
What you should see
No output. A file called config.json now exists in your folder.
This might happen

You want to use your own homeserver instead of matrix.org

Open config.json with: nano config.json — and replace both occurrences of 'matrix.org' with your homeserver's domain, then save with Ctrl+O, Enter, Ctrl+X.

04
Step 4 of 6

Pull and run the Element Docker image

5 min

This command downloads the official Element Web Docker image and starts it on port 8080 of your server. It also mounts your config.json so Element uses your settings. The container restarts automatically if your server reboots.

Terminal · mac
$ docker run -d \
$ --name element-web \
$ --restart unless-stopped \
$ -p 8080:80 \
$ -v $(pwd)/config.json:/app/config.json:ro \
$ vectorim/element-web:latest
What you should see
A long container ID string, e.g.: a3f9c2d1e8b7... — that means it started successfully.
This might happen

Port 8080 is already in use

Change -p 8080:80 to -p 8888:80 (or any free port) and access Element on that port instead.

05
Step 5 of 6

Verify the container is running

1 min

Check that the container started without errors. You should see it listed with a status of 'Up'.

Terminal · mac
$ docker ps --filter name=element-web
What you should see
A table row showing 'element-web', status 'Up X seconds', and port '0.0.0.0:8080->80/tcp'.
This might happen

Status shows 'Exited' instead of 'Up'

Run: docker logs element-web — to see the error. Most often it is a malformed config.json. Validate your JSON at jsonlint.com, fix it, then run: docker restart element-web

06
Step 6 of 6

Open Element in your browser

2 min

Navigate to your server's IP address (or domain) on port 8080. You should see the Element login screen. Sign in with any Matrix account — including a free matrix.org account.

Terminal · mac
$ echo "Open this in your browser: http://$(curl -s ifconfig.me):8080"
What you should see
Prints a URL like: http://203.0.113.42:8080 — open that in Chrome or Firefox.
This might happen

Page does not load / connection refused

Check your server's firewall allows port 8080: sudo ufw allow 8080/tcp — then try again.

// Status

cooked. baked. worked.

A fully working Element Web chat client running in Docker on your server, accessible in a browser, connected to Matrix so you can send and receive messages.

// the honest bit

The honest part

This guide gives you a working HTTP instance on a plain port — fine for testing, not for production. For a real deployment you need a reverse proxy (like Nginx or Caddy) with an SSL certificate so the URL starts with https://. Without HTTPS, some Matrix features (like microphone access for calls) will not work, and browsers may warn users. Also, Element Web is just the client — you still need a Matrix homeserver (matrix.org is free) to actually send messages. Hosting your own homeserver (Synapse or Dendrite) is a separate, larger project.