Skip to main content
03 / How-to · Sites · 3.1

Create a site

Create a WordPress, WooCommerce, PHP, Laravel, static or reverse proxy site, with its database, from the panel or with cgctl, and keep the summary it gives you once.

Type
How-to guide
Needs
An administrator account · A domain whose DNS A or AAAA record points at the server, if you want the certificate straight away
Version
unreleased
Last verified
Unverified

A new site comes with its own system user, folder, vhost and, except for static and reverse proxy sites, its own PHP. WordPress, WooCommerce and Laravel sites also get their database. Only an administrator can create a site.

From the panel​

  1. Open Sites and choose New site.
  2. In Domain, type the site's name, for example example.com. The panel lowercases it.
  3. In Type, pick the kind of site. The differences are in the site types reference.
  4. In PHP, keep Default version or pick one of the versions installed on the server. Static and reverse proxy sites have no such field.
  5. In Performance profile, keep Recommended or pick Balanced, Commerce or Maximum.
  6. Fill in the fields of the type you picked:
    • WordPress and WooCommerce, under WordPress administrator: Site title (optional; empty means the domain), Admin email, Admin username and Admin password, at least 12 characters (Generate makes one). They are your WordPress sign-in.
    • Reverse proxy: Upstream URL, for example http://127.0.0.1:3000. It must be an http or https URL with no credentials, query or fragment.
  7. Fill in the Database part (below).
  8. Check the line at the bottom, which says what the site will get, and choose Create site.

The database​

The Database part depends on the type:

  • WordPress, WooCommerce and Laravel always have a database: their configuration uses it.
  • PHP and Static: turn on Create a database too to get a MariaDB database and a user with all privileges on it. Off, the site starts with none; you can add one later from the Database tab.
  • Reverse proxy: no database.

When the site gets one, fill in:

  1. Database name and Database user. The panel proposes a name from the domain (blog.example.com gives blog_example) and uses it for both, until you change them.
  2. Database password. The panel fills it with a generated password; keep it, press Generate for another, or type your own. Show displays it.

The names and the password follow the database rules: for example, a name already used on this server, or a password with ', " or \, is refused under its field.

The summary​

After Create site, the dialog becomes the site's summary. At the top, the creation's steps appear as they run: done, in progress or failed. Below, everything you need to use the site:

PartRows
SiteSite URL, In the panel
WordPressAdmin URL, Admin user
DatabaseHost, Port, Socket, Database name, Database user, Database password
SFTPoff, with the site's system user to turn it on
  • Download as .txt saves the whole summary as <domain>-cloudground.txt. The file holds passwords: keep it somewhere safe and delete it once you have stored them elsewhere.
  • Copy copies the same text to the clipboard.
  • Close without either asks Close without saving? first; leaving or reloading the page asks too.
  • Open the site goes to the site's page.

The site appears in the list as provisioning. When the Site creation task ends, the status becomes active.

If the panel's Settings have a Let's Encrypt email, creation also requests the certificate. If DNS does not point at the server yet, the site is created anyway: the task says so in its messages (Certificate pending (DNS may not point here yet)), and the site answers with the server's self-signed fallback certificate (CN=fallback.invalid), which browsers refuse, until you issue one from the SSL tab.

SFTP starts off​

A new site's SFTP access is off: nobody can sign in over SFTP until you turn it on, with a password of its own, from the site's SFTP / SSH tab. See SFTP and SSH keys.

With cgctl​

bash
cgctl --wait sites create example.com wordpress \
'{"admin_email":"you@example.com","admin_user":"admin","admin_password":"<password>","title":"My site"}'
  • <password> is the WordPress administrator's password, at least 12 characters.
  • The third argument is JSON with the optional fields: profile, php_version, cache_enabled, object_cache, aliases, and proxy_upstream for a reverse proxy.
  • --wait waits for the task to end and exits 0 only if it succeeded.

The database options:

OptionEffect
--with-databaseA database for a php or static site too.
--db-name <name>The database's name. Without it, site_<id>.
--db-user <name>The user's name. Without it, site_<id>.
--db-password-stdinReads the password from one line of standard input.
--db-password-file <file>Reads the password from a file.
--db-password <password>The password on the command line: cgctl warns that ps and the shell history show it. Prefer the two above.
--jsonPrints the API's JSON answer instead of the summary.

Without a password the panel generates one. For example, a Laravel site with the password in a file readable by root only:

bash
cgctl --wait sites create shop.example.com laravel \
--db-name shop --db-user shop_app --db-password-file /root/shop-db.pass

cgctl prints the same summary as the panel, once:

shop.example.com (laravel, site 7)
Created.

Site
URL: https://shop.example.com/
Panel: /sites/7

Database
Host: 127.0.0.1
Port: 3306
Socket: /run/mysqld/mysqld.sock
Name: shop
User: shop_app
Password: <password>

SFTP
Off: turn it on from the site's SFTP tab (user cg-site-7).

The database password is shown only now: keep it safe. A new one can be set from the site's Database tab.

On the server's local socket the panel link is the path only; over https:// it is a full address. For a reverse proxy:

bash
cgctl --wait sites create app.example.com proxy '{"proxy_upstream":"http://127.0.0.1:3000"}'

If creation fails​

  • The domain is already in use by another site, as its domain or an alias: the request is refused before anything is created.
  • A database or user name is already used on this server, or breaks the rules: the request is refused, naming the field, before anything is created.
  • The PHP version is not installed: pick one of those listed under PHP.
  • A step of the creation fails: the server undoes the steps already done and the site leaves the list. The task's message names the step that failed.
  • The panel loses contact with the server during creation: the site stays in the list as error. Delete it and create it again.

Next step​

Give the site a certificate and its aliases.

Was this page useful?
Edit this page ↗