Portainer listens on both HTTP and HTTPS out of the box. If you only use HTTPS, you can close the plain one.
In Settings under SSL certificate, turn on Force HTTPS only. It disables the listener on port 9000 when Portainer is on 9443. The command-line way is --http-disabled, which overrides --http-enabled.
docker run -d ... portainer/portainer-ce:lts --http-disabled
The caveats are written right next to the setting. Verify that HTTPS works first, or you lock yourself out of the web UI. The docs also say agents and Edge Agents must talk to Portainer over HTTPS before you force it. The setting does not affect standard Agent deployments.
There is a sibling, Force Secure cookies, that sets the Secure attribute on login cookies. It breaks login over plain HTTP, which is the point.
I would use this setting on anything that is reachable from outside the house.
If you reach Portainer through a reverse proxy, check how the proxy talks to it first. A proxy that still points to port 9000 stops working the moment you turn HTTP off. Change the target to HTTPS on 9443, test it, and only then flip the setting.
Further reading: General settings, CLI configuration, On this site: start Portainer with –admin-password-file instead of typing the password in time, On this site: give containers made outside Portainer an owner with an access-control label
Going deeper: Run degoog on Unraid as your own search page, compared with SearXNG and 4get