Deploy Boxcoin SAAS on VPS Ubuntu Nginx Server

Deploy Boxcoin SAAS on VPS Ubuntu Nginx Server

people

Lets Try

. 8 min read

Many people find it difficult to install the Boxcoin SaaS version on a raw or self-managed VPS. In reality, the process is quite simple. Anyone can purchase a low-cost VPS and deploy Boxcoin easily with the right setup.

How to Install Boxcoin SaaS on a Self-Managed Ubuntu VPS (No cPanel or Plesk)

All you need is a VPS running Ubuntu 24.04, and in this guide, we’ll build everything step by step specifically for the Boxcoin SaaS application using Nginx.

I couldn’t find a clear, complete guide for installing Boxcoin SaaS on a VPS without Plesk or cPanel. Most tutorials rely on control panels, which add extra cost and overhead. This approach is different: a clean, raw VPS setup that is cost-effective, lightweight, and very fast.

If you’re looking for a simple and performance-focused way to deploy Boxcoin SaaS on your own server, this guide is for you.

Image

✅ What We Need

To deploy Boxcoin SaaS successfully, you’ll need the right VPS hosting—preferably one that is fast, affordable, and supports Ubuntu 24.04. You don’t need any control panels like cPanel or Plesk; a clean VPS setup works best.

Here are some recommended VPS providers you can choose from:

  • Webdock - 3$

  • DigitalOcean - 7$

  • Hetzner - 4$

  • Hostinger - 5$

  • Vultr - 5$

  • OVH - 5$

  • Linode - 6$

All of these offer reliable VPS plans that are suitable for deploying Boxcoin SaaS on a raw Ubuntu server.

System Overview

  • Server: Ubuntu 24.04 (Noble)

  • Web Server: Nginx 1.28.1

  • PHP Versions: 7.4, 8.0, 8.2, 8.5 (using PHP-FPM)

  • Database: MySQL 8.0.44

  • Additional Services: Docker, Docker Compose, phpMyAdmin

  • Domain: yourdomain.com

  • Application Type: PHP-based payment/crypto platform

1. System Preparation

1.1 Update System

plaintext
sudo apt update
sudo apt upgrade -y

1.2 Install Essential Packages

plaintext
sudo apt install -y software-properties-common ca-certificates curl gnupg lsb-release unzip zip

1.3 Create Swap (2GB)

plaintext
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
sudo sysctl vm.swappiness=10
sudo sysctl vm.vfs_cache_pressure=50
echo -e "vm.swappiness=10\nvm.vfs_cache_pressure=50" | sudo tee -a /etc/sysctl.conf

2. Web Server Installation

2.1 Add Ondřej Surý PPAs

plaintext
sudo add-apt-repository ppa:ondrej/php -y
sudo add-apt-repository ppa:ondrej/nginx -y
sudo apt update

2.2 Install Nginx

plaintext
sudo apt install -y nginx
sudo systemctl enable nginx
sudo systemctl start nginx

3. PHP Installation

3.1 Install Multiple PHP Versions

plaintext
# Install PHP 7.4
sudo apt install -y php7.4-fpm php7.4-cli php7.4-common php7.4-mysql php7.4-xml php7.4-mbstring php7.4-curl php7.4-zip php7.4-gd php7.4-intl php7.4-bcmath php7.4-readline php7.4-sqlite3 php7.4-json
# Install PHP 8.0
sudo apt install -y php8.0-fpm php8.0-cli php8.0-common php8.0-mysql php8.0-xml php8.0-mbstring php8.0-curl php8.0-zip php8.0-gd php8.0-intl php8.0-bcmath php8.0-readline php8.0-sqlite3
# Install PHP 8.2
sudo apt install -y php8.2-fpm php8.2-cli php8.2-common php8.2-mysql php8.2-xml php8.2-mbstring php8.2-curl php8.2-zip php8.2-gd php8.2-intl php8.2-bcmath php8.2-readline php8.2-sqlite3
# Install PHP 8.5 (Primary)
sudo apt install -y php8.5-fpm php8.5-cli php8.5-common php8.5-mysql php8.5-xml php8.5-mbstring php8.5-curl php8.5-zip php8.5-gd php8.5-intl php8.5-bcmath php8.5-readline php8.5-sqlite3

3.2 Enable and Start PHP-FPM Services

plaintext
sudo systemctl enable php7.4-fpm php8.0-fpm php8.2-fpm php8.5-fpm
sudo systemctl start php7.4-fpm php8.0-fpm php8.2-fpm php8.5-fpm

3.3 PHP-FPM Socket Locations

  • PHP 7.4: /run/php/php7.4-fpm.sock

  • PHP 8.0: /run/php/php8.0-fpm.sock

  • PHP 8.2: /run/php/php8.2-fpm.sock

  • PHP 8.5: /run/php/php8.5-fpm.sock

4. MySQL Installation

4.1 Install MySQL Server

plaintext
sudo apt install -y mysql-server
sudo systemctl enable mysql
sudo systemctl start mysql

4.2 Set Root Password

plaintext
# Get debian-sys-maint credentials
sudo cat /etc/mysql/debian.cnf
# Set root password (replace PASSWORD with your secure password)
mysql -u debian-sys-maint -p<PASSWORD_FROM_DEBIAN_CNF> -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YOUR_ROOT_PASSWORD'; FLUSH PRIVILEGES;"

4.3 Create SAAS DB Application Database and User

plaintext
mysql -u root -p<<EOF
CREATE DATABASE box_cloud_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'super_user_box'@'localhost' IDENTIFIED BY 'YourPassword';
GRANT ALL PRIVILEGES ON *.* TO 'super_user_box'@'localhost'; G
RANT GRANT OPTION ON *.* TO 'super_user_box'@'localhost'; 
FLUSH PRIVILEGES; 
EOF

4.3 Create SAAS Payment DB ( used to store SAAS user payments, invoices, settings )

plaintext
mysql -u root -p<<EOF
CREATE DATABASE Payment_cloud_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
FLUSH PRIVILEGES; 
EOF

5. phpMyAdmin Setup

5.1 Download and Install

plaintext
cd /var/www/html
sudo wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz
sudo tar -xzf phpMyAdmin-latest-all-languages.tar.gz
sudo mv phpMyAdmin-5.2.3-all-languages phpmyadmin
sudo rm phpMyAdmin-latest-all-languages.tar.gz

5.2 Configure phpMyAdmin

5.3 Create phpMyAdmin Storage Database

plaintext
mysql -u root -p < phpmyadmin/sql/create_tables.sql

Add to phpmyadmin/config.inc.php:

plaintext
/* Storage database and tables */
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
$cfg['Servers'][$i]['relation'] = 'pma__relation';
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
$cfg['Servers'][$i]['history'] = 'pma__history';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
$cfg['Servers'][$i]['recent'] = 'pma__recent';
$cfg['Servers'][$i]['favorite'] = 'pma__favorite';
$cfg['Servers'][$i]['users'] = 'pma__users';
$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
$cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
$cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
$cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';

5.4 Nginx Configuration for phpMyAdmin

Create /etc/nginx/sites-available/phpmyadmin:

plaintext
server {
    listen 80;
    server_name phpmyadmin.yourdomain.com;
    root /var/www/html/phpmyadmin;
    index index.php index.html index.htm;
    access_log /var/log/nginx/phpmyadmin_access.log;
    error_log /var/log/nginx/phpmyadmin_error.log;
    location / {
        try_files $uri $uri/ =404;
    }
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.5-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
    location ~ /\.ht {
        deny all;
    }
    location ~ /(libraries|setup/frames|setup/libs) {
        deny all;
        return 404;
    }
}

Enable site:

plaintext
sudo ln -s /etc/nginx/sites-available/phpmyadmin /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx

6. Application Deployment (boxcoin)

6.1 Create Application Directory

plaintext
sudo mkdir -p /var/www/html/yourdomain.com
sudo chown -R www-data:www-data /var/www/html/yourdomain.com

6.2 Download and Extract Application

upload the script to folder - /var/www/html/yourdomain.com through Filezilla ( in bellow example i uploaded the zip file to other server and got link - downloaded directly to server with wget command )

plaintext
cd /var/www/html/yourdomain.com
sudo wget https://ftp-link-of-file-server-change-it.xyz/saas.zip
sudo unzip -q saas.zip
sudo rm saas.zip

6.3 Set Permissions

plaintext
# Add admin user to www-data group
sudo usermod -aG www-data admin
# Set directory ownership and permissions
sudo chown -R www-data:www-data /var/www/html/yourdomain.com
sudo chmod -R 775 /var/www/html/yourdomain.com
# Set writable directories
sudo chmod -R 775 /var/www/html/yourdomain.com/uploads
sudo chmod -R 775 /var/www/html/yourdomain.com/cloud
sudo chmod -R 775 /var/www/html/yourdomain.com/cloud/config
sudo chmod -R 775 /var/www/html/yourdomain.com/cloud/backup
sudo chmod 644 /var/www/html/yourdomain.com/cloud/*.php

6.4 Configure Application

Edit /var/www/html/yourdomain.com/config.php:

Generate Bcrypt Hash password - http://bcrypt.online/

plaintext
<?php

define('CLOUD_SUPER_EMAIL', '[email protected]');
define('CLOUD_SUPER_PASSWORD', '$2y$10$DtjydO3hCxeDCNJTbaey3O5eQGJPTyJtoXFhV1gi0R.zkF.eDEWXm');

define('CLOUD_DB_NAME', 'box_cloud_db');
define('CLOUD_DB_USER', 'super_user_box');
define('CLOUD_DB_PASSWORD', 'yourdbpass');
define('CLOUD_DB_HOST', 'localhost');
define('CLOUD_IP', 'localhost');
define('CLOUD_URL', 'https://yourdomain.com/');
define('CLOUD_KEY', '8CdV1oMszQn9KYp9Cq3ZxN2VaM8CdV1oMs');
define('CLOUD_KEY_2', 'ZrYp9Cq3ZxN2VaYp9Cq3ZxN2VaMb94Q');
define('CLOUD_WEBHOOK_KEY', 'TqVyPdLs1XwTqVyPs1XwEa9UcZdJtLQ');
define('CLOUD_WEBHOOK_API_KEY', 'TqVyPdLs1XwEa9Ucq3ZxN2VaMbMJg3Cq');
define('CLOUD_API_KEY', 'q3ZxN2VaMbC0TaTqVyPs1XwEa9');

define('CLOUD_SMTP_HOST', 'smtp.sendbun.com');
define('CLOUD_SMTP_USERNAME', 'mybunn');
define('CLOUD_SMTP_PASSWORD', 'em_smtp_OsewwcxYptYQbm');
define('CLOUD_SMTP_PORT', 587);
define('CLOUD_SMTP_SENDER', '[email protected]');
define('CLOUD_SMTP_SENDER_NAME', 'Your App Name');

define('CLOUD_NAME', 'X Pay');
define('CLOUD_LOGO', 'https://yourdomain.com/media/logo.svg');
define('CLOUD_LOGO_PNG', 'https://yourdomain.com/media/logo.png');
define('CLOUD_ICON', 'https://yourdomain.com/media/icon.svg');
define('CLOUD_DISCLAIMER', 'By creating an account you agree to our <a target="_blank" href="https://boxcoin.dev/terms-of-service">Terms Of Service</a> and <a target="_blank" href="https://boxcoin.dev/privacy">Privacy Policy</a>.<br />&copy; 2022 boxcoin.dev. All rights reserved.');
define('CLOUD_EMAIL', 'This email was sent to you by Boxcoin. By using our services, you agree to our <a href="https://boxcoin.dev/privacy" target="_blank" style="color:#a0abb2;text-decoration:none;">Privacy Policy</a>.<br />&copy; 2022 <a href="https://boxcoin.dev/privacy" target="_blank" style="color:#a0abb2;text-decoration:none;">boxcoin.dev</a>. All rights reserved.');
define('CLOUD_WELCOME_EMAIL', ['Welcome to Boxcoin', 'Hello!<br>You have successfully registered an account with Boxcoin. Thank you for choosing Boxcoin! We\'re thrilled to have you with us. To get started and to learn how to use Boxcoin visit our docs at <a style="text-decoration:none;color:#1bb8c4;" href="https://boxcoin.dev/docs/">https://boxcoin.dev/docs/</a>.']);
define('CLOUD_POWERED_BY', ['https://yourdomain.com', 'https://yourdomain.com/media/logo.svg']);
define('CLOUD_DOCS', 'https://BBB');

define('OPEN_EXCHANGE_RATE_APP_ID', 'AAA');
define('BLOCKDAEMON_API_KEY', 'AAA');
define('TATUM_API_KEY', 'AAA');
define('STRIPE_KEY', 'AAA');
define('APPROXIMATED_KEY', 'AAA');
define('APPROXIMATED_TARGET_DOMAIN', 'AAA');

define('ENVATO_PURCHASE_CODE', 'AAA');

//define('CLOUD_AWS_S3', ['amazon-s3-access-key' => '', 'amazon-s3-secret-access-key' => '', 'amazon-s3-bucket-name' => '', 'amazon-s3-region' => '']);
//define('CLOUD_FEE', 0.008);
//define('CLOUD_CUSTOM_PHP', '');
//define('CLOUD_CUSTOM_JS', '');

?>

6.5 Nginx Configuration for Yourdomain.com

Create /etc/nginx/sites-available/yourdomain.com:

plaintext
server {
    listen 80;
    server_name yourdomain.com;
    root /var/www/html/yourdomain.com;
    index admin.php index.php index.html index.htm;
    access_log /var/log/nginx/yourdomain.com_access.log;
    error_log /var/log/nginx/yourdomain.com_error.log;
    # Gzip compression
    gzip on;
    gzip_vary on;
    gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml+rss application/javascript application/json image/svg+xml;
    # Cache control for static files
    location ~* \.(jpg|jpeg|gif|png|css|js|ico|svg|eot|ttf|woff|woff2|otf)$ {
        expires 1y;
        add_header Cache-Control "public, immutable";
    }
    # Remove trailing slashes
    rewrite ^/(.*)/$ /$1 permanent;
    # Root redirect to admin.php
    location = / {
        try_files $uri /admin.php;
    }
    # Cloud directory - handle PHP files directly
    location ^~ /cloud/ {
        try_files $uri $uri/ =404;
        
        location ~ \.php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/run/php/php8.5-fpm.sock;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
        }
    }
    # URL rewrites for checkout, invoice, id
    location ~ ^/checkout/(.+)$ {
        try_files $uri /pay.php?checkout_id=$1;
    }
    location ~ ^/invoice/(.+)$ {
        try_files $uri /pay.php?invoice=$1;
    }
    location ~ ^/id/(.+)$ {
        try_files $uri /pay.php?id=$1;
    }
    # Try to serve file directly, fallback to .html, then .php
    location / {
        try_files $uri $uri.html $uri.php $uri/ =404;
    }
    # PHP processing
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.5-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
        
        # Disable caching for PHP
        add_header Cache-Control "no-cache, no-store, must-revalidate";
        add_header Pragma "no-cache";
        add_header Expires "0";
    }
    # Deny access to hidden files
    location ~ /\. {
        deny all;
    }
}

6.6 Enable Site

plaintext
sudo ln -s /etc/nginx/sites-available/yourdomain.com /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx

7. Security & Firewall

7.1 UFW Firewall (if needed)

plaintext
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 45876/tcp  # Beszel agent
sudo ufw enable

8. Install Cron (if not installed)

8.1 installation

plaintext
sudo apt update
sudo apt install -y cron
sudo systemctl enable cron
sudo systemctl start cron
sudo systemctl status cron

8.2 Setup Application Cron Job

plaintext
(crontab -l 2>/dev/null; echo "0 0 * * * /usr/bin/curl -s 'https://yourdomain.com/cloud/api.php?action=cron&api-key=CLOUD_API_KEY' >> /home/root/cron.log 2>&1") | crontab -

8.3 Verify Installation

plaintext
crontab -l

Log File: /home/root/cron.log

Cron Syntax

plaintext
* * * * * command
│ │ │ │ │
│ │ │ │ └─── Day of week (0-7, Sun=0 or 7)
│ │ │ └───── Month (1-12)
│ │ └─────── Day of month (1-31)
│ └───────── Hour (0-23)
└─────────── Minute (0-59)

More Stories from

Lets Try
Lets Try.4 min read

Set Up Daily MySQL Backups to DigitalOcean Spaces (S3-Compatible)

Step-by-Step Guide to implement Automated MySQL Database Backup to DigitalOcean Spaces or s3 compatible buckets (With Retention & Logs) on Ubuntu server.

.
Lets Try
Lets Try.3 min read

Raspberry Pi NAS: Install OpenMediaVault + CasaOS (Step-by-Step Guide)

Turn your Raspberry Pi into a powerful NAS by installing OMV for RAID storage and CasaOS for a simple UI—build a secure, user-friendly home cloud.

Dev
Dev.2 min read

Window Server 2025 Contabo VPS Install Guide

Window server in contabo is very costly but you can deploy your license key with custom image.

Dev
Dev.1 min read

Setting up SSH keys to a Ubuntu Server with Mac

Generating SSH keys on a Mac for use with an Ubuntu server is a straightforward process. Here’s a step-by-step guide: Generate the SSH Key Pair

.
Dev
Dev.1 min read

Git/Github Clone Private Repository on Ubuntu Server 24.04

GitHub is a free platform that provides repository hosting and We will guide you to install Git on Ubuntu 24.04, adding and cloning a repository from GitHub to your Ubuntu VPS server.

.
Built on Koows