# The site on the internet: server, domain and HTTPS

All chapters  [1 Before you start](https://eile.site/en/cookbook/before-you-start)[2 Install](https://eile.site/en/cookbook/install)[3 Pages](https://eile.site/en/cookbook/pages)[4 Your first template](https://eile.site/en/cookbook/first-template)[5 Components](https://eile.site/en/cookbook/components)[6 Site frame](https://eile.site/en/cookbook/layout)[7 Page fields](https://eile.site/en/cookbook/fields)[8 Page lists](https://eile.site/en/cookbook/lists)[9 Custom settings](https://eile.site/en/cookbook/settings)[10 Measuring visit](https://eile.site/en/cookbook/form)[11 Live parts](https://eile.site/en/cookbook/live-parts)[12 Go live](https://eile.site/en/cookbook/go-live)[13 What’s next](https://eile.site/en/cookbook/next)

# The site on the internet: server, domain and HTTPS

So far the site lives on your computer. Let’s move it to a server, connect a domain and turn on HTTPS. You’ll need a Linux server and a domain, and Eile does the rest by itself.

Chapter 12 of 13 · 7 min read

## Server and domain

You need a small virtual server (VPS) with Linux: the cheapest plan with 1 GB of memory at any hosting provider will do. When you order it, choose Ubuntu or Debian. The host sends you the server’s IP address, for example `203.0.113.10`, and the password for the root user.

You buy a domain from a registrar. This chapter uses `facade.example`; put your own domain wherever you see it. In the domain’s DNS settings, create two A records, one for `facade.example` and one for `www.facade.example`, both with the server’s IP address. The records take anywhere from a few minutes to a couple of hours to spread across the internet.

## Log in to the server

You talk to a server over SSH. It’s the same terminal, except the commands run on another computer. In the terminal on your own computer, type:

```
$ ssh root@203.0.113.10
```

Enter the password from your host. The prompt changes: from now on, your commands go to the server. Install Eile the same way as in chapter two:

```
$ curl -fsSL https://github.com/a-sharapov/eile/releases/latest/download/install.sh | bash
```

When you install as root, the program goes to `/usr/local/bin/cms`. Leave the server with the `exit` command:

```
$ exit
```

## Move the site

The whole site is in `site.db`. First make a copy of it on your computer, in the `facade` folder:

```
$ cms backup facade-copy.db
```

You can make the copy while the site is running: it comes out complete, with no half-written records. Email, Telegram and the mail gateway belong to this computer, not the site, and are not part of the copy. If you have set them up already, take them along in a server settings file:

```
$ cms backup --server facade-server.enc
```

The command asks for a passphrase twice, at least 12 characters: the file is encrypted with it, since it holds the mail password and the bot token. Now send both files to the server with `scp`, a command that copies files over SSH:

```
$ scp facade-copy.db facade-server.enc root@203.0.113.10:
```

## Run it as a service

If you start `cms` in the server’s terminal, the site stops as soon as you close the window. That’s why it runs as a service: Linux starts it when the server boots and restarts it if something goes wrong. Eile creates the service by itself. Log in to the server again and run one command, replacing the domains and the email with your own:

```
$ ssh root@203.0.113.10
$ cms service install --domain facade.example,www.facade.example --email you@example.com --from facade-copy.db
```

- `--domain facade.example,www.facade.example`: the addresses the site lives at. Eile gets an HTTPS certificate for them from Let’s Encrypt by itself, renews it and sends visitors from http to https.
- `--email`: Let’s Encrypt writes to this address if something is wrong with the certificate.
- `--from facade-copy.db`: the copy of the site you brought along. Eile moves it to `/var/lib/cms/site.db`, and after that you can delete `facade-copy.db`.

First the command checks that the domains point to this server, that ports 80 and 443 are free and that there is enough memory. If something is wrong, it tells you what to fix. Then it creates the service, starts it and waits for the site to answer. At the end you see `✓ The service cms is running` with the addresses of the site and the manager.

After a minute, open `https://facade.example`: the site is there, with a padlock in the address bar. The manager is at `https://facade.example/manager`, and you sign in with the same email and password you used at home, because they moved along with the database.

What’s left is the server settings from the file. The command asks for the same passphrase:

```
$ cms restore --server facade-server.enc --db /var/lib/cms/site.db
```

Email, Telegram and the mail gateway work right away: the service picks them up by itself, no restart needed. Then delete `facade-server.enc` from the server and from your folder: it is only for the move. If you have no such file, set up email and Telegram in the manager again.

`cms service status` shows how the site is doing. To see the service file without changing anything, add `--print`.

## The site address in the settings

In the manager, open **Settings** → **Site** and enter the site address: `https://facade.example`. Eile uses it to build links for search engines, the sitemap and previews on social networks.

## Backups

In **Settings** → **Backups and updates**, turn on automatic backups, for example once a day at three in the morning, keeping the last seven. The server makes them by itself. If a backup fails, you get a notification.

A backup that sits only on the same server won’t help if that server breaks. So in the same place, under **Backups off the server**, connect a storage: for example DigitalOcean Spaces at the same host, or Backblaze B2. Enter the storage address, the bucket, the access key and its secret, press **Check connection** and save. From now on every automatic backup goes to the storage encrypted, and the storage keeps the last fourteen.

Now and then, download a backup to your own computer too: it’s one button in the **Backups** section of the manager header.

## Updates

When a new version of Eile comes out, the manager shows it in the account menu. Updating on the server takes one command:

```
$ cms update
```

It downloads the new version, checks its checksum, does a test run and restarts the service. If the new version doesn’t come up, `cms update` puts the previous one back and tells you. Before you update an alpha version, it’s a good idea to make a backup with `cms backup`.