# Ports and networking

A server is not on your own network. Every port that you open on it gets a public address, and everything else is closed. This page explains what you see and how to keep traffic private.

## Which ports are open

The ports come from the template, and you can add more for one launch under **Advanced > Extra ports** on the configure step. A template lists up to 16 ports, each from 1 to 65535, TCP or UDP.

Open the server and select **Connect**. The **Ports** table shows:

| Column | Meaning |
|---|---|
| Server port | The port your software listens on, inside the server |
| Public port | The port you use from outside. It is usually different |
| Protocol | TCP or UDP |
| Address | The address to use from outside, with an **Open** button for web ports |

Always use the public port and the address from the table. Do not assume the two numbers are the same. They can change after a stop and start, so read the table again after each start.

### Apps and ports page

While a server runs, **Apps and ports** on the server page lists every app and port of the server on one page: what each one is (for example **Jupyter notebook** or **Web app**), how you sign in to it, an **Open** button, and a dot that shows whether the port answers from our side right now (**Answering**, **Not answering yet**). **Check again** probes the ports once more.

The same check is `GET /api/v1/servers/{id}/portal-health` in the API and `apidly ports SERVER_ID` in the CLI. "Answering" means a connection to the port succeeded from our side; it does not prove the app inside works.

## Make your software reachable

Your software must listen on `0.0.0.0`, not on `localhost`, and on a port that is in the table. Check from inside the server:

```bash
ss -tlnp
```

A program that listens on `127.0.0.1` can be reached only from the server itself, which is what you want for something private (see the tunnel below).

## Encrypted or not

Each address in the table is labelled **HTTPS** or **HTTP, not encrypted**. Direct app links, including the Jupyter link, are plain HTTP. The page, your code and any token travel as plain text. SSH is always encrypted.

For anything sensitive, do not use a plain HTTP link. Use an SSH tunnel.

## SSH tunnel

A tunnel forwards a port of your own computer to a port on the server through the encrypted SSH connection. Replace the values from the **Connect** tab:

```bash
ssh -N -L 8080:localhost:8000 -p PORT root@HOST
```

Keep the command running and open `http://localhost:8080` on your computer. Your software on the server can then listen on `127.0.0.1` only. The **Connect** tab shows a ready tunnel command for Jupyter. A tunnel needs an SSH key on the server. See [Connect with SSH](/docs/connect-ssh).

Several tunnels at once:

```bash
ssh -N -L 8080:localhost:8000 -L 9090:localhost:9000 -p PORT root@HOST
```

On Windows use the same command in PowerShell. See [SSH from Windows](/docs/windows-ssh).

## What is not available

- The ports are set at launch. To use other ports, deploy a new server with them.
- Servers do not get a fixed address. Treat the address as valid only while the server runs.
- Data transfer is not metered, so network traffic is not charged.

## Protect what you expose

A public port is open to anyone with the address. Add authentication to your software and never expose databases or admin pages without a password. See [Expose an app](/docs/expose-an-app).
