This guide walks you through deploying AI Infos Web Statistics on a fresh Ubuntu 22.04 VPS. The steps apply to any provider: DigitalOcean, Vultr, Hetzner, Linode, or a dedicated server.
What you need before you start
- A VPS with Ubuntu 22.04 LTS (1 CPU, 1GB RAM is enough for up to 1M monthly page views)
- A domain or subdomain pointed at the VPS IP (e.g.
stats.yourdomain.com) - SSH access to the server
Step 1: Install the LAMP stack
sudo apt update && sudo apt upgrade -y
sudo apt install apache2 mysql-server php8.2 php8.2-mysql php8.2-mbstring -y
sudo a2enmod rewrite && sudo systemctl restart apache2
Step 2: Create the database
sudo mysql -u root
CREATE DATABASE web_stats CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'statsuser'@'localhost' IDENTIFIED BY 'YourStrongPassword';
GRANT ALL PRIVILEGES ON web_stats.* TO 'statsuser'@'localhost';
FLUSH PRIVILEGES; EXIT;
Step 3: Upload and configure the app
Upload the project to /var/www/web-stats/ with the document root pointing to the public/ subdirectory. Copy config/app.example.php to config/app.php and fill in your database credentials, domain URL, and SMTP mail settings.
Step 4: Install SSL with Let's Encrypt
sudo apt install certbot python3-certbot-apache -y
sudo certbot --apache -d stats.yourdomain.com
Step 5: Run the setup wizard
Open https://stats.yourdomain.com/setup in your browser. The wizard creates all database tables and your Super Admin account in about 2 minutes.
Step 6: Install the tracking script
Go to Websites → Add Website, copy the 2KB tracking snippet, and paste it before </body> on your site. Visit your site in a private browser window — you should see yourself appear in the Real-Time tab within seconds.