# Putting a site or an application online

Your VPS Ultra has its own IPv4 address and its IPv6 address: your domains point directly to them, and your server receives traffic on every port you open. You serve as many sites and domains as you wish.

## 1. Point your domain to your server

Wherever your domain's DNS zone is managed, create two records with the addresses shown in your server's card, **VPS** section of your client area:

| Type   | Name                                 | Value                               |
| ------ | ------------------------------------ | ----------------------------------- |
| `A`    | `@`, `www` or the subdomain you want | the **IPv4 address** from your card |
| `AAAA` | the same name                        | the **IPv6 address** from your card |

When your domain's DNS zone is managed by Simafri, our team sets up these records for you: write to us. Before switching over a site that is already live, also ask us to lower the record's time to live (TTL).

To check from your computer:

```
dig +short A app.my-company.com

dig +short AAAA app.my-company.com
```

## 2. Install your web server and your certificate

Two common choices on Linux:

* **Caddy**, which obtains and renews your HTTPS certificates on its own:

  ```
  apt install caddy
  ```

  then, in `/etc/caddy/Caddyfile`:

  ```
  app.my-company.com {

      reverse_proxy 127.0.0.1:3000

  }
  ```

  and `systemctl reload caddy`;

* **Nginx** or **Apache**, with **Certbot** for the Let's Encrypt certificate:

  ```
  apt install nginx certbot python3-certbot-nginx

  certbot --nginx -d app.my-company.com -d www.app.my-company.com
  ```

  Certbot installs the certificate, adds listening on port 443 and schedules its automatic renewal.

On Windows Server, **IIS** serves your sites, and an ACME client such as win-acme installs and renews your Let's Encrypt certificates there.

## 3. Keep your application running

A Node.js, Python, Go or Java application that runs continuously is entrusted to **systemd**: it starts with the server and restarts on its own if it stops. Example, in `/etc/systemd/system/app.service`:

```
[Unit]

Description=My application

After=network.target



[Service]

WorkingDirectory=/srv/app

ExecStart=/usr/bin/node server.js

Restart=always

Environment=NODE_ENV=production

User=www-data



[Install]

WantedBy=multi-user.target
```

```
systemctl daemon-reload

systemctl enable --now app

journalctl -u app -f    # follow its logs
```

Docker and Docker Compose also install as on any Linux server.

## 4. Your database

PostgreSQL, MySQL, MariaDB, Redis or MongoDB install with the package manager, or from the vendor's official repository. The guaranteed memory of your VPS Ultra suits a demanding database well: set its working memory (`shared_buffers` for PostgreSQL, `innodb_buffer_pool_size` for MySQL) according to the memory of your size.

Keep your database listening on `localhost`, and administer it from your computer through an SSH tunnel:

```
ssh -L 5432:localhost:5432 root@app.my-company.com
```

Your tool (DBeaver, pgAdmin, TablePlus) then connects to `localhost:5432`.

## Frequently asked questions

### My site shows a certificate error.

Check in this order: your `A` and `AAAA` records point to the addresses on your card (`dig`), your web server listens on ports 80 and 443 (`ss -tlnp`), your firewall lets them through (`ufw status`), and the certificate covers this name (`certbot certificates`).

### Can I host several sites on my VPS Ultra?

Yes, as many as you wish: point each domain to your addresses and add its block to your web server.
