# How to change the default CasaOS port

Canonical: https://kextcache.com/change-port-casaos/
Published: 2025-02-22T04:54:46+05:30
Updated: 2026-11-18T11:18:00+05:30
Author: Ayush Sahay Chaudhary

*Updated 18 Nov 2026: the terminal method now edits `/etc/casaos/gateway.ini` and restarts `casaos-gateway`, and the dashboard, firewall and Cloudflare Tunnel steps match the current CasaOS code and the ufw and Cloudflare docs.*

CasaOS serves its dashboard on port 80 by default. If port 80 is taken on first start, the gateway picks the first free port from 81 to 89, then from 8080 to 8089. CasaOS keeps its web UI port in `/etc/casaos/gateway.ini`, on the `port=` line under `[gateway]`. To change it, click the Settings icon in the dashboard's top bar, find **WebUI Port** and click **Change**. Or edit that line over SSH and run `sudo systemctl restart casaos-gateway`. The main `casaos.conf` file has no port setting, so editing it changes nothing.

These steps follow the source code of CasaOS v0.4.15 (CasaOS-Gateway v0.4.9-alpha4, CasaOS-UI v0.4.25), the versions the official installer still sets up on 18 Nov 2026. Our February 2025 video shows the dashboard method on the same CasaOS version. For this update we ran the terminal method (Steps 2 and 3) on a test install. The dashboard, firewall and remote access steps follow the docs.

> **Tested by our setup on 17 Nov 2026**
>
> - What we did: read `gateway.ini` and `casaos.conf`, set `port=8085` in `gateway.ini`, restarted `casaos` (the dashboard stayed on port 80), restarted `casaos-gateway` (the dashboard moved to 8085 and port 80 stopped answering), then set the port back to 80
> - On: a Debian 12.15 VM (x86-64, KVM, 2 vCPU, 3 GB) on our home server, CasaOS v0.4.15 from the official installer
> - Not tested: the dashboard's WebUI Port dialog, editing in nano (we changed the line with `sed`), ufw, Cloudflare Tunnel, Tailscale and any Raspberry Pi

## Why change the CasaOS port

You need a new port when another app on the same machine wants port 80, such as a reverse proxy or Pi-hole's web interface. Or you may just want the dashboard on a port you'll remember. Moving it does not make the dashboard more secure, because a port scan finds it on any port.

On a fresh install, CasaOS takes port 80 if it is free. If another program already holds 80, the gateway picks the first free port from 81 to 89, then from 8080 to 8089, and saves it in `gateway.ini`. That is why some dashboards open on 81 or 8080 without anyone choosing it.

## Step 1: Change the CasaOS port in the dashboard

Watch the step-by-step video here.

<a class="yt" data-yt="1RitQq5KMkE" href="https://www.youtube.com/watch?v=1RitQq5KMkE">How to Change the Port in CasaOS – Step-by-Step Guide | Kextcache</a>

*We recorded this silent video in February 2025 on CasaOS v0.4.15, the version the installer still sets up. It goes through the same Settings menu, **WebUI Port** row and **Edit WebUI port** dialog as the steps below and moves the port from 8080 to 9090. After **Submit**, we typed the 9090 address into the browser ourselves and got the CasaOS login page. The video covers the dashboard method only.*

Write down your server's IP address first. After the change, the dashboard moves to `http://<server-ip>:<new-port>`, and the old address stops answering.

1. Open the CasaOS dashboard in your web browser.
2. Click the Settings icon in the top bar. It looks like three sliders, and its tooltip says "Settings".
3. In the menu that opens, find the **WebUI Port** row, which shows the current port, and click **Change**.
4. In the **Edit WebUI port** dialog, type the new port, for example 9090. The field accepts 80 to 65535, and CasaOS refuses a port that another program is already using.
5. Click **Submit**.

CasaOS starts listening on the new port and sends your browser there. The old port closes about a second later, so you don't need to restart anything. In our video the new address opened on the CasaOS login page, so have your CasaOS username and password ready.

If you prefer a manual method, or the dashboard won't load, go on to the next step.

<a class="embed-card" href="/top-docker-apps-home-server/">Top 24 Docker apps for your home server (2026 guide)</a>

## Step 2: Edit gateway.ini from the terminal

CasaOS stores its configuration files in `/etc/casaos`. The web port belongs to the `casaos-gateway` service, which reads it from `gateway.ini`. The `casaos.conf` file in the same folder configures the main CasaOS service and has no port key at all.

Open a terminal on the machine that runs CasaOS, or SSH into it. That can be a Raspberry Pi, a mini PC or any other Linux box. Then check the current port:

*Tested by our setup on 17 Nov 2026: Debian 12.15 VM, CasaOS v0.4.15. The path comes from the [CasaOS-Gateway setup script](https://github.com/IceWhaleTech/CasaOS-Gateway/blob/main/build/scripts/setup/service.d/gateway/debian/bullseye/setup-gateway.sh).*

```bash
cat /etc/casaos/gateway.ini
```

The sample file ships with `port=` empty, and the gateway writes the port it picked into the file on first start. With port 80 free, the file on our test install looked like this:

*Tested by our setup on 17 Nov 2026: `cat /etc/casaos/gateway.ini` on the Debian 12.15 VM right after a fresh CasaOS v0.4.15 install.*

```ini
[common]
runtimepath=/var/run/casaos

[gateway]
logfileext=log
logpath=/var/log/casaos
logsavename=gateway
port=80
```

Open the file in nano:

*From the official docs: [`gateway.ini.sample`](https://github.com/IceWhaleTech/CasaOS-Gateway/blob/main/build/sysroot/etc/casaos/gateway.ini.sample), checked 17 Nov 2026. Not run by us.*

```bash
sudo nano /etc/casaos/gateway.ini
```

Change the number on the `port=` line, for example to `port=9090`. The key is lowercase `port`, under `[gateway]`.

Save and exit: press **CTRL + X**, then **Y**, and hit **Enter**.

## Step 3: Restart the CasaOS gateway

The gateway reads the port when it starts, so restart it:

*From the official docs: [`casaos-gateway.service`](https://github.com/IceWhaleTech/CasaOS-Gateway/blob/main/build/sysroot/usr/lib/systemd/system/casaos-gateway.service) in the CasaOS-Gateway repository, checked 17 Nov 2026. Tested by our setup on 17 Nov 2026 (Debian 12.15 VM, CasaOS v0.4.15): after this restart the gateway listened on 8085, and port 80 stopped answering.*

```bash
sudo systemctl restart casaos-gateway
```

Restarting `casaos` instead does not move the port. In our test the gateway stayed on port 80 after `sudo systemctl restart casaos`, because that service runs the main CasaOS app with `casaos.conf` ([`casaos.service`](https://github.com/IceWhaleTech/CasaOS/blob/main/build/sysroot/usr/lib/systemd/system/casaos.service)). It was the right step on CasaOS v0.3.2 in 2022, when the port lived in a different file ([issue #282](https://github.com/IceWhaleTech/CasaOS/issues/282)).

Check that the gateway listens on the new port:

*Tested by our setup on 17 Nov 2026 (Debian 12.15 VM). The [netstat(8) man page](https://manpages.debian.org/bookworm/net-tools/netstat.8.en.html) (Debian bookworm, checked 17 Nov 2026) calls `netstat` "mostly obsolete" and names `ss` as its replacement.*

```bash
sudo ss -tlnp | grep casaos-gateway
```

The output should list the new port. Then open `http://<server-ip>:9090` in your browser. `sudo netstat -tulnp | grep casaos` also works on machines set up with the CasaOS installer, because the installer adds `net-tools`.

### If the dashboard doesn't load on the new port

Over SSH, `cat /etc/casaos/gateway.ini` shows the port CasaOS is set to, so you can look up a number you forgot. If the port is right and the page still doesn't load, check the firewall in Step 4. To go back, set `port=` to the old value and restart `casaos-gateway` again.

## Step 4: Update firewall rules (if needed)

This step applies only if ufw is enabled on the server. `sudo ufw status` tells you. If it says the firewall is active, allow the new port:

*From the official docs: [ufw(8) man page](https://manpages.debian.org/bookworm/ufw/ufw.8.en.html), Debian bookworm, ufw 0.36.2, checked 17 Nov 2026. Not run by us.*

```bash
sudo ufw status
sudo ufw allow 9090/tcp
sudo ufw reload
```

The man page lists `reload` but does not say you need it after `allow`, so treat the last line as optional.

## Step 5: Update remote access (Cloudflare Tunnel and Tailscale)

If you reach CasaOS through Cloudflare Tunnel, point the tunnel at the new port. Tailscale needs no change. If you haven't set up remote access yet, see [how to access CasaOS remotely](/how-to-access-casaos-remotely/).

### Cloudflare Tunnel

For a tunnel created in the Cloudflare dashboard, the kind Cloudflare [recommends "for most use cases"](https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/do-more-with-tunnels/local-management/), go to **Networking > Tunnels**, select your tunnel and open the **Routes** tab. Edit the published application for CasaOS and change its **Service URL** to `http://localhost:9090`. This menu path comes from Cloudflare's [Create a tunnel (dashboard)](https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/get-started/create-remote-tunnel/) page, last updated 23 Jun 2026.

For a tunnel that runs from a local config file, open the `config.yml` your `cloudflared` service reads. Cloudflare's Linux service page expects it at `$HOME/.cloudflared/config.yml`; if yours lives somewhere else, such as `/etc/cloudflared/config.yml`, edit that one. The routes sit under `ingress`, and the list has to end with a catch-all rule. Change the port in the `service:` line of your CasaOS rule and leave the rest of the file alone.

*From the official docs: [Configuration file](https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/do-more-with-tunnels/local-management/configuration-file/), Cloudflare, last updated 10 Nov 2026, with an example hostname and port 9090 filled in. Not run by us.*

```yaml
ingress:
  - hostname: casaos.example.com
    service: http://localhost:9090
  - service: http_status:404
```

Check the file, then restart the service:

*From the official docs: [Configuration file](https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/do-more-with-tunnels/local-management/configuration-file/) (last updated 10 Nov 2026) and [Run as a service on Linux](https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/do-more-with-tunnels/local-management/as-a-service/linux/) (last updated 17 Apr 2026), Cloudflare. Not run by us.*

```bash
cloudflared tunnel ingress validate
sudo systemctl restart cloudflared
```

If your file has a single `url:` line instead of `ingress` rules, change the port on that line, for example to `url: http://localhost:9090`, and restart `cloudflared` as above. Cloudflare's [Create a locally-managed tunnel](https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/do-more-with-tunnels/local-management/create-local-tunnel/) page (last updated 13 Oct 2026) still shows this format for a single published application, next to `tunnel:` and `credentials-file:`. We have not run it.

### Tailscale

With the default access policy, every device in your tailnet can reach every other device, and the CasaOS gateway listens on all network interfaces, Tailscale's included, so nothing changes on the Tailscale side. Open CasaOS at your server's Tailscale IP with the new port:

*From the official docs: [Tailscale IP addresses](https://tailscale.com/kb/1015/100.x-addresses) (KB 1015, last validated 12 Jan 2026). Tailscale gives devices addresses from 100.64.0.0/10. Not run by us.*

```text
http://100.x.x.x:9090
```

If ufw is on, the Step 4 rule covers the Tailscale interface too, because it is not tied to one interface. Tailscale's own [ufw guide](https://tailscale.com/kb/1077/secure-server-ubuntu) allows all traffic on it with `sudo ufw allow in on tailscale0`. If you have written your own [access control policy](https://tailscale.com/kb/1018/acls), make sure it still allows the new port.

## Conclusion

The dashboard's WebUI Port setting is the quickest way to change the CasaOS port, and `/etc/casaos/gateway.ini` is the fallback when the dashboard won't load. Either way, update whatever still points at the old port: ufw rules, a Cloudflare Tunnel route and your bookmarks.

For a hands-on walkthrough, watch our video tutorial:

<a class="yt" data-yt="1RitQq5KMkE" href="https://www.youtube.com/watch?v=1RitQq5KMkE">How to Change the Port in CasaOS – Step-by-Step Guide | Kextcache</a>

Need help? Drop a comment below.

Related guides:

- [CasaOS review, install and uninstall guide](/casaos-install-review-uninstall/)
- [How to set up CasaOS on Raspberry Pi 5](/setup-casaos-raspberry-pi-5/)
- [Best home server software for Linux](/best-home-server-software-for-linux-in-2025/)
- [How to build a home server: the beginner's guide](/ultimate-home-lab-guide/)

## Changes

- 18 Nov 2026: the terminal method now sets `port=` in `/etc/casaos/gateway.ini` and restarts `casaos-gateway`. The old steps edited `casaos.conf`, which has no port setting.
- 18 Nov 2026: the dashboard steps follow the current menu (Settings icon, WebUI Port, Change, Submit), with no restart.
- 18 Nov 2026: updated the Cloudflare Tunnel steps, switched the port check to `ss`, added the default port fallback, a recovery step and sources, and removed the security claim.
- 18 Nov 2026: added our test of the terminal method (Steps 2 and 3) on a Debian 12 VM with CasaOS v0.4.15, and the full `gateway.ini` from that install.
