GoAdmio

alias

Create or delete an alias domain (parked domain) for a hosted site

On this page: Overview · Quick start · Syntax · Arguments · Output · Examples · Troubleshooting · Details · See also


Overview

An alias domain (also called a parked domain) is an extra domain name that shows the same website as a hosted domain. /go/alias creates or deletes one. To create an alias, it:

It does not change DNS. Point the alias domain to this server yourself.


Quick start

# Make parked.com show the same site as example.com
/go/alias parked.com example.com

Syntax

/go/alias <alias-domain> <primary-domain>
/go/alias <alias-domain> <primary-domain> delete

The command takes positional arguments and has no -- options.


Arguments

Position Argument Required Notes
1 <alias-domain> Yes The extra domain name.
2 <primary-domain> Yes A hosted domain, with a folder in /home.
3 delete No Deletes the alias instead of creating it.

The domains are used as typed. They are not lowercased or checked for a valid format, so pass full, plain domain names.

When deleting, the alias is found by its name alone. The primary domain must still be given in position 2, but it is not used to match the alias.


Output

Create

Message Meaning
Creating a domain alias <alias>... The checks passed and the alias is being set up.
The domain alias <alias> was created. Done.

Delete

Message Meaning
Alias Domain <alias> has been deleted. The alias was removed from the alias database.

Errors

Each of these stops the command with status 1. Nothing is created.

Message Meaning
Account <alias> already exists in recycle bin The alias is a terminated account waiting to be removed.
Website <alias> already exists. /home/<alias> exists, so the alias is already a hosted site.
Website <primary> not exists. /home/<primary> does not exist.

For the recycle bin error, the command also prints the steps to follow: remove the account forever from Recover Terminated Accounts, then run the command again.


Examples

# Create an alias
/go/alias parked.com example.com
# Delete an alias
/go/alias parked.com example.com delete
# Review the log of past runs
tail -n 20 /var/log/go/alias.log

Troubleshooting

Symptom Likely cause Fix
Website <alias> already exists. The alias domain is already a hosted account. Choose a different alias, or remove the account with delete.
Website <primary> not exists. The primary domain is misspelled or not hosted. Check the name with ls /home, or create the account with create.
Account <alias> already exists in recycle bin The alias domain belongs to a terminated account. Remove it from the recycle bin, then run the command again.
The alias is created but the site does not open The alias domain's DNS does not point to this server. Point its A record to the server's IP address. See dns.
HTTPS does not work right after creation The SSL run starts in the background. Wait a few minutes, then run ssl for the primary domain if it is still missing.
The alias still answers after delete The delete only removes the database record. Rebuild the web server configuration with conf.
has been deleted appears for an alias that never existed The delete does not check that the alias exists. None.
create reports that a domain "is already an alias" The domain is stored in the alias database. Delete the alias first, then create the account.

Details

What is stored

Creating an alias adds one row to the Alias table of the alias database.

Field Value
AliasDomain The alias domain.
Domain The primary domain.
Username The account username of the primary domain, taken from the Site table.
TimeStamp The time of creation.

Order of checks

# Check Error
1 The alias is in the recycle bin. Account <alias> already exists in recycle bin
2 /home/<alias> exists. Website <alias> already exists.
3 /home/<primary> does not exist. Website <primary> not exists.

[!NOTE] The script also tries to detect an alias that already exists, but its comparison uses the wrong values and never matches. Creating the same alias twice is therefore not rejected.

What creating an alias runs

# Step
1 Insert the alias row.
2 Rebuild the primary domain's Apache configuration with apache.
3 Rebuild the primary domain's Nginx configuration with nginx.
4 Start ssl for the primary domain in a detached screen session.

Logging

Every run appends its arguments with a timestamp to /var/log/go/alias.log.

What a run does

flowchart TD
    A["alias alias primary [delete]"] --> B{"delete?"}
    B -- "Yes" --> C["Delete the alias row, exit 1"]
    B -- "No" --> D{"Alias in recycle bin, or already hosted?"}
    D -- "Yes" --> X1["Error, exit 1"]
    D -- "No" --> E{"Primary hosted?"}
    E -- "No" --> X2["Error, exit 1"]
    E -- "Yes" --> F["Insert alias row"]
    F --> G["Rebuild Apache and Nginx configuration"]
    G --> H["Start ssl in the background"]
    H --> I["Print: alias was created"]

See also

Command Description
create Create a GoAdmio account from the command line
domain Change the primary domain of a hosting account
primary Convert an addon domain to a primary domain
subdomain Create, edit, or delete a subdomain
ssl Install an SSL certificate for a domain in GoAdmio
conf Rebuild the Apache/Nginx configuration in GoAdmio
dns Add your domain to Cloudflare and edit the DNS zone