Docker VPS: Portainer and CasaOS on Your Own Domain with Let's Encrypt SSL In the examples 203.0.113.10 is your server IP address and my-site.com is your domain. Use your own values. What you get After a Docker VPS is set up, its panels open by IP address: Portainer at https://203.0.113.10:9443 (the browser warns “Your connection is not private” because the certificate is self-signed) and CasaOS at http://203.0.113.10 (no encryption at all, the password is sent in clear text). With this guide both panels get addresses on your domain with a free Let's Encrypt certificate: https://panel.my-site.com — Portainer; https://casa.my-site.com — CasaOS. We use the free Nginx Proxy Manager app (NPM below) from the CasaOS App Store. NPM receives visitors on the standard ports 80 and 443, issues Let's Encrypt certificates, renews them by itself and passes requests to the panels. Everything is done with the mouse in a browser, no command line needed. It takes about 20 minutes. Why not the built-in settings: Portainer can only accept a ready-made certificate file; it cannot issue or renew Let's Encrypt certificates. CasaOS has no certificate settings at all. NPM solves it for both panels at once, and later you can use it to open any of your containers on a domain. What you need A working domain. If you ordered the domain from us, it must be activated: fill in the domain registration details in the client area. The server IP address — it is in the server activation email and in the client area on the service page. The CasaOS login and password and the Portainer password — from the same email. Your real email address — Let's Encrypt sends service notices to it. Server IP address in the VPS activation email (example) Step 1. Create the panel and casa A records You need two records, panel and casa, both pointing to the server IP. Create them where your domain's DNS is hosted. Check the domain's name servers (NS): ns1.vps-dns.info and ns2.vps-dns.info are our DNS servers (option A); anything else means DNS at your registrar or Cloudflare (option B). Option A. The domain uses our DNS (ns1/ns2.vps-dns.info) In the client area, on the VPS page, click “Manage Domains in VDS”, then “Login to DNSmanager control panel”. The DNS panel opens without a password. If the domain is not in the list yet, add it first with the “Add New Domain into DNSmanager” button (details in DNS zone of a domain for VPS). Client area: “Manage Domains in VDS” → “Login to DNSmanager control panel” In the DNS panel, open “Dashboard” → “Domain names” on the left, select the domain and click “Records”. Click “Add” and fill in the form: “Name” — panel (the panel adds the domain itself), “Type” — A (internet address v4), “IP address” — your server IP. Click “Ok”. New record: name panel, type A, server IP address The panel.my-site.com. record appears in the list. Create the second record named casa the same way. The panel.my-site.com A record in the records list (the casa record is created the same way) Option B. DNS at your registrar or in Cloudflare Open DNS management for the domain at your registrar (or in Cloudflare) and add two records: TypeName (Host)Value (IP)Apanel203.0.113.10Acasa203.0.113.10 Cloudflare: turn proxying off for the panel and casa records — the cloud icon must be grey (“DNS only”). Then Let's Encrypt checks the domain directly on your server. We tested it: the Cloudflare proxy passes only ports 80 and 443, not 9443, 8090 or 81, so with the orange cloud the old port-based access through the domain will not open either. Step 2. Check that the records work A new record usually starts working within 5–30 minutes; with some registrars it can take a few hours. Check both records with the nslookup command (Command Prompt on Windows, Terminal on macOS and Linux) or with any online DNS lookup service: nslookup panel.my-site.com 8.8.8.8 nslookup casa.my-site.com 8.8.8.8 The answer must show your server IP: The record works: panel.my-site.com points to the server IP If you see NXDOMAIN or a different IP, wait and check again. Certificates cannot be issued until the records work. Step 3. Free port 80 for NPM: move CasaOS to port 8090 CasaOS currently uses port 80, and NPM needs it — Let's Encrypt checks the domain through it. So first move CasaOS to another port, for example 8090. 3.1. Open the CasaOS settingsLog in to CasaOS at http://203.0.113.10. Click the “Settings” icon (three sliders) at the top left. In the “WebUI Port” line, click “Change”.CasaOS: Settings → WebUI Port → Change 3.2. Enter port 8090Replace 80 with 8090 and click “Submit”.New WebUI port 8090 → SubmitIn a few seconds CasaOS restarts on the new port. Open http://203.0.113.10:8090 and log in again (same login and password). Remember port 8090 — you will need it in step 7. Step 4. Install Nginx Proxy Manager from the CasaOS App Store 4.1. Open the App StoreOn the CasaOS home page, click the “App Store” tile.CasaOS home: the App Store tile 4.2. Find Nginx Proxy ManagerIn the App Store search box, type Nginx Proxy Manager. In the Nginx Proxy Manager card (Network category), click “Install”.Search: Nginx Proxy Manager → Install 4.3. Read the tip and click “Next Steps”A “Tips” window appears with a warning: the app uses ports 80 and 443, plus port 81 for its admin page, and the CasaOS WebUI port must be changed to anything other than 80/81/443. We already did that in step 3, so click “Next Steps”.Tips window → Next Steps 4.4. Wait for the installation to finishInstallation takes about a minute. When it is done, a “Nginx Proxy Manager” tile appears on the CasaOS home page.The Nginx Proxy Manager tile on the CasaOS home page Step 5. First login to Nginx Proxy Manager 5.1. Log in with the default credentialsClick the Nginx Proxy Manager tile or open http://203.0.113.10:81. Log in with the app defaults: “Email address” — [email protected], “Password” — changeme, then click “Sign in”.NPM login: default email and password → Sign inEveryone knows the default password, so change it right away — that is the next two steps. 5.2. Enter your own emailRight after login the “Edit User” window opens. Fill in “Full Name” and “Nickname” as you like, and enter your real address in “Email” — it becomes your NPM login and is used when issuing certificates. Do not keep the example.com address: Let's Encrypt rejects it. Click “Save”.Edit User window: your email → Save 5.3. Change the passwordNext, the “Change Password” window opens: “Current Password” — changeme, “New Password” and “Confirm Password” — a new strong password twice. Click “Save” and keep the new password. If the window does not appear, open it manually: “Admin” at the top right → “Change Password”.Change Password window: current and new password → Save Step 6. The panel.my-site.com address for Portainer 6.1. Open Proxy HostsIn the top menu, click “Hosts” → “Proxy Hosts”.Hosts → Proxy Hosts menu 6.2. Click “Add Proxy Host”Click “Add Proxy Host” on the right.The Add Proxy Host button 6.3. Fill in the Details tabOn the “Details” tab:“Domain Names” — type panel.my-site.com and press Enter (the address turns into a grey tag);“Scheme” — https (Portainer works over https only);“Forward Hostname / IP” — your server IP 203.0.113.10;“Forward Port” — 9443;turn on “Block Common Exploits” and “Websockets Support” (needed for the container console and live updates).Details: panel.my-site.com → https, server IP, port 9443 6.4. Request a certificate on the SSL tab and saveOpen the “SSL” tab:“SSL Certificate” — choose Request a new SSL Certificate (with Let's Encrypt);turn on “Force SSL” (always redirect to https) and “HTTP/2 Support”;“Email Address for Let's Encrypt” — your email (filled in automatically);turn on “I Agree to the Let's Encrypt Terms of Service”.Click “Save”. Issuing the certificate takes 10–30 seconds; do not close the window meanwhile. If everything is fine, the window closes by itself and a panel.my-site.com row appears in the list.SSL: Request a new SSL Certificate, Force SSL, HTTP/2, email, agreement → Save Step 7. The casa.my-site.com address for CasaOS Click “Add Proxy Host” again and fill in the form the same way, with different values: 7.1. Details tab“Domain Names” — casa.my-site.com (and Enter), “Scheme” — http, “Forward Hostname / IP” — 203.0.113.10, “Forward Port” — 8090 (the new CasaOS port from step 3). Turn on “Block Common Exploits” and “Websockets Support” — without websockets the CasaOS home page does not update.Details: casa.my-site.com → http, server IP, port 8090 7.2. SSL tabAs in step 6.4: “Request a new SSL Certificate”, “Force SSL”, “HTTP/2 Support”, email, agreement. Click “Save”.SSL for casa.my-site.com → Save You should end up with two hosts: PanelDomain NamesSchemeForward Hostname / IPForward PortPortainerpanel.my-site.comhttps203.0.113.109443CasaOScasa.my-site.comhttp203.0.113.108090 Step 8. Check the result in NPM 8.1. Both hosts show Let's Encrypt and OnlineIn the “Proxy Hosts” list, both addresses must show “Let's Encrypt” in the “SSL” column and a green “Online” in the “Status” column.Proxy Hosts list: casa and panel — Let's Encrypt, Online 8.2. Open the host settingsMake sure the https redirect is on: for each host click the “⋮” icon on the right and choose “Edit”.The ⋮ icon → Edit 8.3. Turn on Force SSL if it is offOn the “SSL” tab, the “Force SSL” and “HTTP/2 Support” switches must be on. On our test server they turned out to be off after the first certificate was issued — in that case turn them on and click “Save”. The certificate is not issued again.Edit Proxy Host → SSL: Force SSL and HTTP/2 Support on → Save Step 9. Log in at the new addresses 9.1. Portainer — https://panel.my-site.comOpen https://panel.my-site.com — without a port. The usual Portainer login screen appears with no warnings; clicking the icon to the left of the address shows “Connection is secure”. The Portainer login and password are the same as before, from the email.Portainer at https://panel.my-site.com — connection is secure 9.2. CasaOS — https://casa.my-site.comOpen https://casa.my-site.com. The CasaOS login and password are the same as before. Bookmark both addresses.CasaOS at https://casa.my-site.com — connection is secure NPM renews certificates by itself: it checks them daily and renews those expiring within 30 days. For that, the A records must point to the server and NPM must be running (the tile in CasaOS). If you type the address with http://, NPM redirects to https://. What about access by IP? The old addresses https://203.0.113.10:9443 (Portainer) and http://203.0.113.10:8090 (CasaOS) keep working. We recommend leaving them as a fallback — useful if the domain stops working. They cannot be closed with “one button”: Docker itself opens these ports, normal server firewall rules do not apply to them, and reworking it from the command line can easily lock you out of the panels. Simply use the new https addresses, especially on cafe, hotel and other public networks. The NPM admin page itself (http://203.0.113.10:81) is not encrypted — use it only for configuration. If you like, it can also get a domain: add a proxy host such as npm.my-site.com → http, server IP, port 81, with a certificate, as in step 7. App tiles inside CasaOS still open apps by IP and port. The same way you can open any of your containers on a domain with a certificate: “Add Proxy Host” → its domain, the server IP and the container port. Troubleshooting A red “Internal Error” when saving NPM: “Internal Error” while issuing a certificate This is how NPM reports that Let's Encrypt could not verify the domain. The panel shows no details, so check in order: The record does not work or points to another IP. Check it with the command from step 2. If the answer looks like the screenshot below or shows someone else's IP, fix the A record and wait. Cloudflare with the orange cloud — switch the record to “DNS only” (grey cloud). A typo in “Domain Names” — it must be, for example, panel.my-site.com, without https:// and without a port. nslookup: the record does not work yet or was created incorrectly After a failure, a host without a certificate may remain in the list (“HTTP only” in the “SSL” column). Once the cause is fixed, open it (“⋮” → “Edit”), choose “Request a new SSL Certificate” on the “SSL” tab again and click “Save” — or delete the host (“⋮” → “Delete”) and create it again. Do not retry more than 5 times per hour: after that Let's Encrypt temporarily refuses to issue for that name. “Client sent an HTTP request to an HTTPS server” Error “Client sent an HTTP request to an HTTPS server” The Portainer host uses the http scheme. Open the host (“⋮” → “Edit”) and on the “Details” tab set “Scheme” to https. “502 Bad Gateway” Error “502 Bad Gateway” NPM cannot reach the panel. Check “Forward Hostname / IP” (your server IP) and “Forward Port” in the host: 9443 for Portainer, 8090 for CasaOS. If they are correct, make sure the panel itself works: open it by IP and port. CasaOS does not open at http://203.0.113.10 That is expected after step 3: CasaOS is now on port 8090 — http://203.0.113.10:8090 or https://casa.my-site.com. If you cannot sort it out, open a ticket: tell us the domains and the error text.