To add a domain to a tube network that runs from one install, you point the domain at your server with a DNS A record, tell the web server to answer for it (a cPanel alias or parked domain, an nginx server_name entry or an Apache ServerAlias), issue an SSL certificate, and then add the domain as a new site in the script's admin. If the domain must live on a different server, you instead install a small connector there that forwards requests to the main install.
Step 1: point DNS at your server
At your registrar or DNS provider, create an A record for the bare domain pointing to your server's IPv4 address, and either a second A record or a CNAME for www. If your server has IPv6, add an AAAA record too. Changes usually take effect within minutes but can take longer if old records had a long TTL. Check with:
dig +short example2.com
The result should be your server's IP address. If you use a DNS-level proxy or CDN, the result will be the provider's address instead, which is fine.
Step 2: make the web server answer for the domain
The new domain must reach the same document root as your main install, so the script can see which domain was requested and serve the right site.
cPanel
Open Domains (or Aliases / Parked Domains on older versions) and add the domain as an alias of your main domain. Do not create it as an addon domain with its own folder, because that gives it a separate, empty document root. If your cPanel version only offers "Create a new domain", untick the option to share the document root, then set the root to the same public/ folder as the main site.
nginx
Add the domain to the server_name line of the existing server block, or copy the block and change only the name:
server_name main-site.com www.main-site.com example2.com www.example2.com;
Test and reload with nginx -t and systemctl reload nginx.
Apache
Add a ServerAlias line to the existing virtual host:
ServerAlias example2.com www.example2.com
Then run apachectl configtest and reload Apache. Make sure mod_rewrite stays enabled and AllowOverride permits the script's .htaccess rules.
Step 3: add SSL
Every site should load over HTTPS. On cPanel, AutoSSL normally covers aliases automatically within a few hours. On a VPS, Let's Encrypt with certbot is the usual choice. You can issue one certificate per domain or expand the main certificate, for example:
certbot --nginx -d example2.com -d www.example2.com
Use the --apache plugin on Apache servers. Certbot sets up automatic renewal; confirm it with certbot renew --dry-run. Decide whether each site uses www or the bare domain and redirect the other, so search engines see one version.
Step 4: add the site in the admin
Create the site record in your tube script, choose its template, and set its name, logo and content rules. Then open the domain in a browser. If you see your main site's content instead of the new site, the script has not matched the hostname; check the domain was entered exactly as visitors type it, with or without www.
Alternative: a domain on another server
Some operators prefer sites on different hosts, IP addresses or providers. In that case the domain points to the other server, and a connector script on that server forwards each request to the main install and returns the page. Things to check:
- The remote server needs a working PHP with cURL and outbound HTTPS to your main domain.
- Requests between the two should be authenticated so nobody can use your install as an open proxy.
- Caching pages on the remote side reduces load on the main server.
- Video files are best served directly from the main server or a CDN, not relayed through the remote host.
Common problems
- Default server page or wrong site. The web server is not matching the hostname; check the alias or
server_name. - Certificate warning. The certificate does not include the new name, or DNS changed after it was issued.
- Redirect loops. Often caused by mixing an HTTPS redirect at a proxy with another at the server; keep one.
- Login does not carry across sites. Cookies are per domain, so visitors log in separately on each domain even if accounts are shared.
How Tube Site Script handles new domains
In Tube Site Script, every domain pointed at the install's public/ folder can become a site: set it up as a cPanel alias or parked domain, an nginx server_name or an Apache ServerAlias, then add it under Admin › Sites (or with site:add on the command line). Nothing else needs installing, and the new site needs no Installation Key of its own.
For a domain on another server, mark the site as remote and download the connector made for that site from the admin. It needs PHP 7.2+ with cURL. Requests are signed with HMAC-SHA256 within a five-minute window and a replay guard, pages for anonymous visitors are cached on the connector, and video and images load straight from the main install or your CDN. See running multiple tube sites, the Tube Site Script features and pricing.
Frequently asked questions
Should I use an addon domain or an alias in cPanel?
Use an alias or parked domain, so the new domain shares the main site's document root. An addon domain gets its own empty folder and will not reach the install.
How long does DNS take to update?
Often a few minutes, but it can take up to a day or two if the old records had a long TTL. Lowering the TTL before a change makes the switch faster.
When should a site live on a different server?
When you want sites spread across different hosts or IP addresses, or the domain is already hosted elsewhere. A connector forwards requests to the main install so content is still managed in one place.
