Publish a domain with HTTPS on your VPS: nginx, certificates, and the daily 502
Published on 2026-08-25 by frfrand
How to publish a domain with HTTPS on an ArduMaker VPS: the correct order, what certbot does on the host, the internal nginx, and how to diagnose a 502.

Short answer: to publish a domain with HTTPS on an ArduMaker VPS, first point the DNS, then verify, then activate the domain (this issues the certificate on the parent host and routes traffic to your VPS) and, finally, tell the nginx inside your VPS which application that domain goes to. If that last step is missing, the result is a 502.
Putting a domain into production with HTTPS involves a few steps that are almost always done in the wrong order, and that's where the frustration comes from: the certificate fails, a 502 appears, and nobody knows if the problem is the DNS, the proxy, or the application.
In ArduMaker there is additionally a twist that explains most of the stumbling blocks, and this guide covers it first: your VPS is a container inside a shared parent host, and what ends HTTPS —the certificate and the edge nginx— lives on that host, not on your machine. On your VPS side remains another piece: your own nginx, which decides which application each domain goes to. Understanding where each thing happens makes the rest almost obvious.
Tools covered: crear_dominio_vps, listar_dominios_vps, verificar_dominio_vps, activar_dominio_vps, eliminar_dominio_vps, ver_nginx_dominio_vps, editar_nginx_dominio_vps, ver_logs_nginx_vps, publicar_repo_en_dominio, and from the neighboring area listar_redirecciones_vps and crear_redireccion_vps, which serve for the alternative path.
They all carry company_id in addition to vps_id. If you don't know which one it is, listar_empresas tells you, and ver_contexto_inicial returns all the companies, projects, and VPS that your session can see at once.
First things first: your VPS is not alone on the machine
Almost everything that confuses you when publishing a domain on ArduMaker is clarified by understanding one single thing: there are two layers, and you manage the inner one.
The parent host. It is the physical, shared machine, with the public IP. There live things you never touch: the edge nginx that terminates HTTPS, the certificates (certbot runs there, not on your VPS) and the port forwarding that connects the world with your machine. You do not have access to that layer, and it is on purpose: it is shared with other clients.
Your VPS. It is an LXD container inside that host. There run your applications, your systemd services, your tasks, your Linux users and your own internal nginx. All that is yours and you manage it entirely.
The practical consequence, and it is the most important one in this guide:
Your VPS does not have its own public IP. The IP that the internet sees is the parent host's, shared. What makes your site reachable is that the edge nginx forwards your domain's traffic. By default it sends it to the nginx inside your VPS, which listens on port 443 in plain HTTP (TLS was already terminated at the edge) and decides, by server_name, which application each domain goes to:
internet → IP del host padre → nginx de borde (TLS)
↓
tu VPS → nginx interno (:443, HTTP plano) → tu app (127.0.0.1:<puerto>)
There is an alternative path: activating the domain against a port forwarding (a host port connected to an inner port), which bypasses your nginx. It works, but it is the exception and has its costs, which are seen below.
Each VPS also starts with its own DNS name, in the style <slug>.arducloud.com, with an A record pointing to the parent host IP. That name is the one you then use as the destination when connecting a custom domain.
Keep the diagram in mind. The most common errors in this guide are, at bottom, the same error: not knowing which of the two nginx instances is serving, or confusing the port inside the VPS with the host port.
Two different paths, and it's worth knowing which one you're on
Publishing a domain is not a single procedure: there are two, and they behave very differently.
Path A — a subdomain of ArduMaker's default zone
It's the short path. crear_dominio_vps creates, in ArduMaker's zone on Cloudflare, a proxied CNAME pointing to your VPS's DNS name. You don't need to touch any registrar.
And here's what almost no one knows: if the name is single-level (app.arducloud.com), no certificate is issued. It's covered by the default zone's wildcard certificate, which already exists at the edge, and there's no prior DNS verification or ACME validation either. A two-level name (app.cliente.arducloud.com) doesn't fall under that wildcard: the platform creates the record just the same, but the certificate is issued as in Path B.
Two form restrictions worth knowing in advance, because the tool rejects them: the subdomain can have one or two parts, no more, and each part needs at least 3 characters (letters, numbers, and hyphens in the middle).
Path B — your own domain
Here order matters, and a lot.
activar_dominio_vps executes certbot certonly --standalone on the parent host. "Standalone" means that certbot itself starts a server on port 80 to respond to the Let's Encrypt challenge: to do this, it stops the host's nginx, issues the certificate, and starts it back up. It is not a file served by your application at /.well-known/acme-challenge/ — your VPS does not participate in the validation at all.
From this follows the same thing as the classic order, but for the right reason: Let's Encrypt will query your domain's DNS and hit the IP it finds. If that IP is not the parent host's IP where certbot is running, validation fails. DNS first, activation after. And failed attempts are not free: Let's Encrypt limits failed validations per name, and ArduMaker also limits retries per domain.
The correct order, then:
- Point the domain, with an A record to the parent host IP or —more conveniently— with a CNAME to the VPS DNS name (
<slug>.arducloud.com). - Verify with
verificar_dominio_vpsbefore activating. - Activate with
activar_dominio_vps, withouthost_port: it issues the certificate (if needed) and configures the edge nginx to forward the domain to your VPS nginx. - Write the
serverblock inside the VPS.activar_dominio_vpsdoes not write it. If the domain belongs to an app deployed from git, the deploy writes it alone; otherwise, it is done witheditar_nginx_dominio_vps:listen 443;(plain HTTP),server_namewith your domain andproxy_pass http://127.0.0.1:<your app port>;. Without this step, the domain responds with 502.
If what you want to publish is a GitHub repository, publicar_repo_en_dominio does the whole chain in a single call, with a simular mode to see the plan before issuing anything.
A warning about verificar_dominio_vps: it is more permissive than it seems. If the name resolves to the host IP, it returns OK (a_record). If it resolves via CNAME to the VPS name, it also returns OK (cname). But if it resolves to any other IP —the typical case of a domain proxied by Cloudflare, where the world sees Cloudflare's IPs and not yours— it also returns OK, marked as proxy_forwarded. The only case that truly fails is when the name does not resolve to anything.
In other words: an OK from verificar_dominio_vps confirms that the name exists in DNS, not that it always reaches your host. If the domain is proxied and the orange cloud points to another server, the verification passes and the certificate still fails. When in doubt, check the verify_method it returns: proxy_forwarded means "I couldn't verify it", not "it's fine".
Other tools in the area:
listar_dominios_vps shows which edge nginx domains correspond to this machine and which port each one points to. It's the fastest way to reconstruct the full path of a published site.
eliminar_dominio_vps performs the removal: it deletes the DNS record if it was under the default zone, cleans up the edge nginx configuration and the domain's server block inside the VPS. It does not delete the certificate — the response states this explicitly (ssl_cert_deleted: false). If you publish the same name again later, the certificate is still there.
The errors you will see, and what each one means
When something fails after publishing, the error code tells you quite a bit more than it seems.
502 Bad Gateway — nginx is alive, but there's no one on the other side. The most frequent and least understood one. Nginx received the request, tried to forward it, and got no response. In ArduMaker, the most common cause is not the app: it's that the domain's server block is missing from your VPS's nginx, because activar_dominio_vps doesn't write it. After that come the classics: the app isn't listening on the proxy_pass port, or it's down. If you activated the domain against a redirect (with host_port), also check that the redirect points to the correct internal port.
504 Gateway Timeout — the application is alive but takes too long. Nginx connected, but there was no response in time. A local clarification: the edge nginx already comes with timeouts of 360 seconds. If you get a 504 before that, it's your internal nginx that cuts it, which uses its own timeouts (60 seconds by default in nginx). And if it's six minutes without responding, it's a stuck query or a blocked process, and that's where you need to look.
404 or the wrong site — you're missing the server_name. If when entering your domain you see another site, your VPS's nginx didn't find a block matching that name and fell back to the default site. It's a server_name problem, not a DNS problem.
Invalid or "not secure" certificate in the browser. The certificate covers exactly the names for which it was issued. If it was issued for midominio.com and you access www.midominio.com, the browser rightly protests.
The nginx tools, and which is which
Here is the misunderstanding that wastes the most time, so it's worth saying it straight: these tools do not all operate on the same nginx.
activar_dominio_vps and listar_dominios_vps work on the edge nginx, on the parent host. It is the one that terminates HTTPS and decides where each domain goes. There is no tool to read or manually edit that file: it is managed with activar_dominio_vps and nothing else. You also cannot read its logs. (eliminar_dominio_vps cleans both layers.)
ver_nginx_dominio_vps, editar_nginx_dominio_vps and ver_logs_nginx_vps work on the nginx inside your VPS. That one is entirely yours: they read and write the domain configuration inside the container, and the logs they return are those of the domain in /var/log/nginx/, also inside the container.
The practical consequence, in two points:
ver_logs_nginx_vpsonly finds something if your internal nginx serves that domain and declares its logs (/var/log/nginx/<domain>_access.logand_error.log; the blocks written by a git deploy already declare them). If you activated the domain against a redirection, bypassing your nginx, there are no logs on your side: that traffic is only seen by the edge.editar_nginx_dominio_vpsdoes not change where the edge points. It changes which application your nginx sends the domain to, which in the normal path is exactly what you want.
When to use each path, then:
- The normal way →
activar_dominio_vpswithouthost_port, and routing in your internal nginx (written by the deploy or witheditar_nginx_dominio_vps). It gives you logs per domain and lets you put several apps or routes behind the same domain. - The exception →
activar_dominio_vpswith thehost_portof a redirection to your app, bypassing your nginx. It works, but you lose per-domain logs and fine routing.
About editar_nginx_dominio_vps: it is a complete file replacement, not a patch. Always ask the AI to first read the current configuration, apply the change to that content, and write the entire result. What it does have is a safety net worth knowing: before writing it makes a backup, then validates with nginx -t and reloads, and if validation or reload fails it returns the nginx error without leaving the broken configuration applied. You won't leave the VPS without nginx due to a syntax error.
A detail that saves useless work: the edge nginx already comes with client_max_body_size 100M, WebSocket headers (Upgrade / Connection) and X-Forwarded-* headers set. If your problem is that large files cannot be uploaded or that a WebSocket does not connect, the edge is not what limits: check your internal nginx (nginx's default client_max_body_size is 1 MB) or the application.
TÚ: Publicá app.cliente.com en el VPS 9, la app corre en el 3000.
IA: verificar_dominio_vps(company_id = 3, vps_id = 9, domain = "app.cliente.com") -> el nombre no resuelve
"El dominio todavía no apunta a ningún lado. Antes de activar hay que apuntarlo: un A a la IP del host padre, o —más cómodo— un CNAME a <slug>.arducloud.com, que ya tiene el A correcto.
Si activo ahora, certbot corre en el host, la validación de Let's Encrypt no encuentra el dominio y el intento fallido cuenta contra sus límites."
[más tarde]
TÚ: Listo, ya puse el CNAME.
IA: verificar_dominio_vps(company_id = 3, vps_id = 9, domain = "app.cliente.com") -> { "matches_host": true, "verify_method": "cname" }
activar_dominio_vps(company_id = 3, vps_id = 9, domain = "app.cliente.com", email = "admin@example.com") -> certificado emitido, el borde manda el dominio al nginx del VPS
ver_nginx_dominio_vps(company_id = 3, vps_id = 9, domain = "app.cliente.com") -> no hay configuración para ese dominio
"Falta el último paso: el nginx de adentro del VPS no sabe qué hacer con app.cliente.com, y así vas a ver un 502. Lo escribo apuntando al 3000."
editar_nginx_dominio_vps(company_id = 3, vps_id = 9, domain = "app.cliente.com", config = "server { listen 443; server_name app.cliente.com; access_log /var/log/nginx/app.cliente.com_access.log; error_log /var/log/nginx/app.cliente.com_error.log; location / { proxy_pass http://127.0.0.1:3000; proxy_set_header Host $host; } }") -> nginx -t ok, recargado
"Publicado con HTTPS. El camino queda así: app.cliente.com -> borde (TLS) -> nginx del VPS -> :3000."
TÚ: Entro y me da 502.
IA: ver_logs_nginx_vps(company_id = 3, vps_id = 9, domain = "app.cliente.com", log_type = "error") -> connect() failed (111: Connection refused) while connecting to upstream 127.0.0.1:3000
ejecutar_comando_vps(company_id = 3, vps_id = 9, script = "ss -lntp | grep -E ':(3000|3001)'") -> la app está escuchando en el 3001, no en el 3000
"El camino de red está bien armado: el dominio llega a tu nginx y tu nginx lo manda al 3000. El que no está es el 3000: la app arrancó en el 3001.
Dos opciones: cambio el puerto de la app, o cambio el proxy_pass al 3001. ¿Cuál preferís?"
Frequently asked questions
Does my VPS have its own public IP? No. The IP that the internet sees is the parent host's IP, shared with other VPSs. Your site is made reachable by the edge nginx, which forwards the domain to your VPS's nginx (or, on the alternative path, to a port forwarding). Each VPS does have its own DNS name (<slug>.arducloud.com) with an A record to that IP, and it is the most convenient destination for a CNAME from your domain.
Why does certificate issuance fail? Because the DNS does not point to the parent host's IP where certbot runs. Check the DNS first; blind retries waste Let's Encrypt quota and per-domain retries. And remember that an OK from verificar_dominio_vps with verify_method: proxy_forwarded means "the name resolves but I could not confirm that it reaches here", not "everything is fine".
Does a subdomain of the ArduMaker zone also issue a certificate? If it is single-level (app.arducloud.com), no: it is covered by the zone's default wildcard certificate, without ACME validation. If it is two-level (app.cliente.arducloud.com), yes, one is issued.
Do certificates renew automatically? Let's Encrypt certificates last 90 days and are issued on the parent host, a layer you do not administer. Still, it is worth confirming that a site continues to have a valid certificate before a week is left, not after.
I have a 502, should I restart nginx? Almost never is it the solution. Check three things in this order: that the server block for the domain exists in your VPS's nginx (ver_nginx_dominio_vps), that its proxy_pass points to the correct port, and that the app is actually listening there. The domain's error log (ver_logs_nginx_vps with log_type = "error") usually says it in one line.
Can I read the logs of the nginx that terminates HTTPS? No. ver_logs_nginx_vps reads the nginx inside your VPS. If your internal nginx serves the domain and declares its logs, you have all the traffic there; if you activated the domain against a redirect, bypassing your nginx, there are no logs on your side.
Do I need a separate certificate for www? The certificate covers the exact names for which it was issued. If you want to serve the domain with and without www, both names must be covered, each with its own activation.
Can I edit nginx manually? The one inside your VPS, yes, and in the normal path it is part of the procedure. Editing replaces the entire file, so read the current configuration before writing the new one — although if the new one does not validate, it is not applied.
How do I connect the MCP? By adding https://mcp.ardumaker.com/mcp in a compatible client and authorizing it with your account.
Part of the series of guides on the MCP tools of ArduMaker. The previous guide covers DNS, records, and propagation.