How to Install Cachet Status Page on Ubuntu 24.04 Server

Maintaining transparency and informing users about the operational status of your services is critical for trust and effective communication. Cachet is a beautiful, open-source status page system written in PHP, allowing you to easily communicate planned outages, performance issues, and historical incidents. This guide will walk you through installing and configuring Cachet Status Page on Ubuntu 24.04 Server (Noble Numbat), leveraging the powerful Nginx web server, PHP-FPM, and MariaDB for optimal performance. We'll cover manual setup, deployment with Docker, and strategies for automating your status page infrastructure with Ansible, Kubernetes, and Terraform.

Let's keep your users informed!

1. Manual Setup of Cachet Status Page on Ubuntu 24.04 (LEMP Stack)

This method involves installing Nginx, MariaDB, and PHP-FPM on your Ubuntu server to host Cachet.

1.1 Prerequisites

  • A fresh Ubuntu 24.04 Server instance.
  • A non-root user with `sudo` privileges.
  • At least 1GB RAM (2GB+ recommended).
  • A domain name pointing to your server's IP address (e.g., status.yourdomain.com) for easy access and SSL.

1.2 Update System and Install Nginx, PHP & Composer

Start by updating your system and installing Nginx, PHP-FPM (Ubuntu 24.04 defaults to PHP 8.3), and Composer (PHP dependency manager).

sudo apt update && sudo apt upgrade -y
sudo apt install -y nginx php8.3-fpm php8.3-mysql php8.3-mbstring php8.3-xml php8.3-zip php8.3-gd php8.3-curl php8.3-intl php8.3-bcmath php8.3-gmp composer git wget unzip

Ensure PHP-FPM is enabled:

sudo systemctl enable php8.3-fpm --now

1.3 Install MariaDB Database Server

Cachet requires a database. MariaDB is a popular and compatible choice.

sudo apt install -y mariadb-server mariadb-client
sudo systemctl enable mariadb --now
sudo mysql_secure_installation

Follow the prompts for `mysql_secure_installation`: set a strong root password, remove anonymous users, disallow root login remotely, remove the test database, and reload privilege tables.

Log in to MariaDB as root and create a database and user for Cachet:

sudo mysql -u root -p

CREATE DATABASE cachet;
CREATE USER 'cachet'@'localhost' IDENTIFIED BY 'your_cachet_password;
GRANT ALL PRIVILEGES ON cachet.* TO 'cachet'@'localhost';
FLUSH PRIVILEGES;
EXIT;

IMPORTANT: Replace `your_cachet_password` with a secure password.

1.4 Configure PHP for Cachet

Cachet (being a Laravel application) requires specific PHP settings. Edit the PHP configuration file (e.g., `/etc/php/8.3/fpm/php.ini`):

sudo nano /etc/php/8.3/fpm/php.ini

Adjust these parameters to meet Cachet's recommendations:

memory_limit = 256M        ; or more if you have many components/incidents
upload_max_filesize = 16M
post_max_size = 16M
max_execution_time = 300
date.timezone = Europe/Warsaw ; <-- Set your timezone

Save and exit, then restart PHP-FPM:

sudo systemctl restart php8.3-fpm

1.5 Download And Install Cachet & Composer

curl -sS https://getcomposer.org/installer | php 
mv composer.phar /usr/bin/composer

Clone the Cachet repository from GitHub (check Cachet's documentation for the latest stable branch or release tag).

sudo mkdir -p /var/www/html/cachet
sudo chown -R $USER:$USER /var/www/html/cachet # Temporarily set ownership for Composer
cd /var/www/html/cachet
git clone -b 3.x https://github.com/cachethq/cachet.git

Now copy the example environment configuration file using the following command.
cp .env.example .env

Open the environment file using your favorite text editor. 
nano .env

Now find the following lines:

APP_ENV=production
APP_DEBUG=false
APP_URL=https://your.domain.com
APP_KEY=

DB_DRIVER=mysql
DB_HOST=localhost
DB_DATABASE=cachet
DB_USERNAME=cachet
DB_PASSWORD=your_cachet_password
DB_PORT=3306
DB_PREFIX=null

CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
CACHET_EMOJI=false

MAIL_DRIVER=mailgun
MAIL_HOST=smtp.mailgun.org
MAIL_PORT=587
MAIL_USERNAME=admin@your.domain.com
MAIL_PASSWORD=SMTP PASSOWRD
MAIL_ADDRESS=admin@your.domain.com
MAIL_NAME="Your App Name"
MAIL_ENCRYPTION=tls

REDIS_HOST=null
REDIS_DATABASE=null
REDIS_PORT=null

GITHUB_TOKEN=null

Install Composer dependencies and generate application key:

composer install --no-dev -o
php artisan key:generate

Set proper ownership for the web server user (`www-data` on Ubuntu):

sudo chown -R www-data:www-data /var/www/html/cachet
sudo chmod -R 755 /var/www/html/cachet
sudo chmod -R 775 /var/www/html/cachet/bootstrap/cache
sudo chmod -R 775 /var/www/html/cachet/storage

Save and exit. Run migrations and seed data (optional):

php artisan migrate --force
php artisan db:seed # Optional: to generate dummy data

1.7 Configure Nginx for Cachet

Create an Nginx server block for your Cachet site:

sudo nano /etc/nginx/sites-available/cachet.conf

Add the following content. Replace `status.yourdomain.com` with your domain. This configuration is optimized for Laravel applications like Cachet.

server {
   listen 80;
   server_name status.yourdomain.com; # Replace with your domain

   root /var/www/html/cachet/public; # Cachet's public directory
   index index.php;

   location /.well-known/acme-challenge/ {
       default_type "text/plain";
       root /var/www/html; # Certbot webroot for validation
   }

   location / {
       try_files $uri $uri/ /index.php?$query_string;
   }

   location ~ \.php$ {
       fastcgi_split_path_info ^(.+\.php)(/.+)$;
       include snippets/fastcgi-php.conf;
       fastcgi_pass unix:/run/php/php8.3-fpm.sock; # <-- Verify your PHP-FPM socket path
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
       include fastcgi_params;
       fastcgi_param PATH_INFO $fastcgi_path_info;
   }

   location ~ /\.ht {
       deny all;
   }
}

Enable the Nginx site and restart Nginx:

sudo ln -s /etc/nginx/sites-available/cachet.conf /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx

1.8 Install Certbot and Obtain Let's Encrypt SSL

Secure your Cachet site with free SSL certificates:

sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d status.yourdomain.com

Follow the prompts. Certbot will automatically configure Nginx to use SSL and set up automatic renewals.

1.9 Configure Firewall (UFW)

Allow HTTP, HTTPS, and SSH traffic through the firewall:

sudo ufw allow OpenSSH
sudo ufw allow 'Nginx Full'
sudo ufw enable
sudo ufw status

1.10 Run Database Migration

php artisan migrate

1.11 Create The Username & Password For Admin Panel

php artisan cachet:make:user

1.12 Access Cachet Web Interface

Open your web browser and navigate to `https://status.yourdomain.com`. You should see the Cachet setup wizard. Follow the on-screen instructions to create your administrator account and complete the initial setup.

1.12 Enable Cron

/etc/crontab
* * * * * php /path/to/cachet/artisan schedule:run >> /dev/null 2>&1

We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies

More