> ## Documentation Index
> Fetch the complete documentation index at: https://docs.azvian.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> From the downloaded zip to a running install, including the two background jobs monitoring needs

You need no command line for the install itself. The two background jobs in step 4 need either a terminal or your host's cron screen.

## 1. What you need

| | |
| - | - |
| **PHP** | 8.2 or newer, with the extensions `ctype`, `curl`, `fileinfo`, `json`, `mbstring`, `openssl`, `tokenizer` and `xml`. The installer checks all of them for you. |
| **Database** | SQLite (nothing to set up, the default), or MySQL, MariaDB or PostgreSQL. |
| **A web server** | nginx, Apache, Caddy, or any host that lets you choose the document root. |
| **A domain** | Ideally on HTTPS, for example `status.example.com`. |
| **Cron and a long-running process** | See step 4: monitoring needs both. |
| **Outgoing email** | See step 5: invitations, password resets, alerts and subscriber emails all use it. |

The server must be able to make **outbound HTTPS requests**: that is how it checks your sites and talks to the license service.

## 2. Put the files in place

**1. Unzip**

Unzip `azvian-uptime-monitor-<version>.zip` on your server, for example into `/var/www/uptime-monitor`.

**2. Point the web server at public/**

Make the web server's **document root the `public/` folder** inside it, not the folder above. Everything else (your settings, database and code) must not be reachable from the web.

**3. Make folders writable**

The web server's user must be able to write to `storage/`, `bootstrap/cache/`, the `database/` folder and the `.env` file:

```bash theme={null}
chown -R www-data:www-data /var/www/uptime-monitor
chmod -R u+rwX,g+rwX storage bootstrap/cache database
```

If you want MySQL or PostgreSQL instead of SQLite, create an empty database and a user first, then set the `DB_*` values in `.env` **before** step 3. On a fresh unzip the file appears the first time you open the site; you can also copy `.env.example` to `.env` yourself.

> [tab] nginx
>
> ```nginx theme={null}
> server {
>     listen 443 ssl;
>     server_name status.example.com;
>     root /var/www/uptime-monitor/public;
>     index index.php;
>
>     location / {
>         try_files $uri $uri/ /index.php?$query_string;
>     }
>
>     location ~ \.php$ {
>         include fastcgi_params;
>         fastcgi_pass unix:/run/php/php8.3-fpm.sock;
>         fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
>     }
>
>     location ~ /\.(?!well-known) {
>         deny all;
>     }
> }
> ```

> [tab] Apache
>
> Set `DocumentRoot /var/www/uptime-monitor/public`, enable `mod_rewrite`, and allow overrides for that directory (`AllowOverride All`) so the `.htaccess` file that ships in `public/` takes effect.

> [tab] Shared hosting / cPanel
>
> Create the site (or subdomain) and change its document root to the `public` folder inside the unzipped files. If your host will not let you do that, ask them. Please do not leave the project root as the document root.

## 3. Run the installer

Open your site in a browser. A fresh copy sets itself up on the first visit (it creates its own `.env` with a unique encryption key) and sends you to the installer, which:

* checks your server and tells you plainly if something needs fixing;
* asks for your **organisation name**, your name, email and password (at least 10 characters);
* asks you to confirm the **Application URL**: the address people use to reach this install. It is used in emailed links and **your license is tied to it**, so make sure it is right, including `https://`;
* optionally takes your **license key** (you can add it later under **Admin → Licence**);
* runs the database migrations and signs you in.

If the installer says something is wrong, fix it and reload the page; nothing is changed until you press **Install**. When it finishes it locks itself and cannot be run again.

## 4. Start the two background jobs

Uptime checks, alerts and subscriber emails only run if these are set up. The dashboard works without them, but **nothing gets monitored**.

**a) The scheduler**, once a minute:

```cron theme={null}
* * * * * cd /var/www/uptime-monitor && php artisan schedule:run >> /dev/null 2>&1
```

**b) A queue worker**, kept running. With systemd:

```ini theme={null}
# /etc/systemd/system/uptime-monitor-worker.service
[Unit]
Description=Azvian Uptime Monitor queue worker
After=network.target

[Service]
User=www-data
WorkingDirectory=/var/www/uptime-monitor
ExecStart=/usr/bin/php artisan queue:work --sleep=3 --tries=3 --max-time=3600
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target
```

```bash theme={null}
systemctl enable --now uptime-monitor-worker
```

Supervisor works equally well: run the same command as a program.

> [!TIP]
>
> **No way to keep a process running (shared hosting)?** Use one cron line that runs the scheduler and then drains the queue:
>
> ```cron theme={null}
> * * * * * cd /path/to/uptime-monitor && php artisan schedule:run && php artisan queue:work --stop-when-empty --max-time=50 >> /dev/null 2>&1
> ```

## 5. Set up email

Out of the box nothing is sent: `MAIL_MAILER=log` only writes messages to a log file. Edit `.env` and fill in your provider's SMTP details:

```ini theme={null}
MAIL_MAILER=smtp
MAIL_HOST=smtp.your-provider.com
MAIL_PORT=587
MAIL_USERNAME=...
MAIL_PASSWORD=...
MAIL_FROM_ADDRESS="status@example.com"
MAIL_FROM_NAME="Your Company Status"
```

After editing `.env`, restart the queue worker so it picks the change up: `php artisan queue:restart`. The **Alerts** page has a **Send test** button to confirm email works.

## 6. Check it works

1. Add a website under **Monitored sites**. Within about five minutes it has a first check.
2. Under **Alerts**, press **Send test** on your email channel.
3. Under **Status pages**, create a page, tick *Public*, and open its address.
4. Under **Admin → Licence**, enter your key.

## Backups

Back up three things:

* the **database**: for SQLite that is the file `database/database.sqlite`; for MySQL or PostgreSQL a normal dump;
* the **`.env`** file: it holds your encryption key, and without it stored alert URLs and the license key cannot be decrypted;
* the **`storage/app`** folder: uploaded status-page logos.

## Uninstalling

Press **Deactivate** on the Licence page (to free the activation), then delete the folder, the database, and the cron and worker entries.

See [Troubleshooting](https://docs.azvian.com/uptime-monitor/troubleshooting.md) if something does not work.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.