Skip to main content

Overview

The stack command is used to install, manage, and remove server stack components (Nginx, PHP, MySQL/MariaDB) and related tools. Syntax:
stack <option> <arguments>

Installation Options

-html / -nginx

Install Nginx web server. Example:
stack -nginx
With build mode:
stack -nginx -build=light

-php

Install PHP-FPM. Example:
stack -php
Install with Nginx:
stack -php=nginx
With build mode:
stack -php -build=light
Force installation without confirmation:
stack -php=force

-mysql

Install MySQL or MariaDB server. Example:
stack -mysql
Install client only:
stack -mysql=client
With build mode:
stack -mysql -build=light

-lemp

Install complete LEMP stack (Linux, Nginx, MySQL/MariaDB, PHP). Example:
stack -lemp
With build mode:
stack -lemp -build=light
Available build modes:
  • light - Minimal installation without additional tools
  • basic - Standard installation with essential tools (default)

Additional Tools

-letsencrypt

Install Let’s Encrypt (Certbot) for SSL certificates. Example:
stack -letsencrypt

-backups

Install backup tools (duplicity, duply). Example:
stack -backups

-postfix

Install Postfix mail server for PHP mail() function. Example:
stack -postfix

-redis

Install Redis with PHP Redis extension. Example:
stack -redis

-memcached

Install Memcached with PHP Memcached extension. Example:
stack -memcached

-pma

Install phpMyAdmin. Example:
stack -pma

Version Management

-php-ver

Change PHP version. Example:
stack -php-ver=8.3
Available versions: 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5 Version switching preserves:
  • Installed PHP tools (Postfix, Redis, Memcached)
  • phpMyAdmin installation
  • SMTP configuration
  • Site configurations

-mysql-ver

Change MySQL/MariaDB version. For MariaDB:
stack -mysql-ver=11.8
Available MariaDB versions: 10.5, 10.6, 10.11, 11.4, 11.8 For MySQL:
stack -mysql-ver=8.0
Available MySQL versions: 8.0, 8.4, 9.1, 9.2 Important notes:
  • Downgrading MySQL/MariaDB is not supported
  • phpMyAdmin is preserved during version changes
  • Data is kept during version upgrades
  • Cannot mix MySQL and MariaDB data

Removal Options

-purge

Remove stack components. Remove Nginx:
stack -nginx -purge
Remove with data retention:
stack -nginx -purge=keep-data
Force removal without confirmation:
stack -nginx -purge=force
Remove PHP:
stack -php -purge
Remove MySQL/MariaDB:
stack -mysql -purge
Remove MySQL/MariaDB keeping data:
stack -mysql -purge=keep-data
Remove Let’s Encrypt:
stack -letsencrypt -purge
Remove backup tools:
stack -backups -purge
Remove Postfix:
stack -postfix -purge
Remove Redis:
stack -redis -purge
Remove Memcached:
stack -memcached -purge
Remove phpMyAdmin:
stack -pma -purge

-purge-server-all

Remove entire Webinoly stack. Example:
stack -purge-server-all
Force removal without confirmation:
stack -purge-server-all=force
What gets removed:
  • Nginx and all sites
  • PHP-FPM and all extensions
  • MySQL/MariaDB and all databases
  • Let’s Encrypt certificates
  • Backup tools
  • Postfix
  • Redis
  • Memcached
  • phpMyAdmin
  • Pre-installed packages (pwgen, unzip)
  • Swap (if created by Webinoly)
  • All configuration files

Information

-info

Display stack information. Example:
stack -info
Shows:
  • Installed components and versions
  • Service status
  • Resource usage
  • Configuration details

Arguments

-build

Specify build mode for installations. Available modes: light mode:
  • Minimal installation
  • No additional tools
  • Suitable for containers or minimal setups
basic mode (default):
  • Standard installation
  • Includes recommended tools
  • Postfix (for PHP mail)
  • Redis (for object caching)
  • Memcached (for session storage)
Examples:
stack -lemp -build=light
stack -php -build=basic
stack -mysql -build=light

-purge

Control removal behavior. Values:
  • No value - Standard removal with confirmation
  • force - Skip confirmation prompts
  • keep-data - Remove packages but keep data and configuration
Examples:
stack -nginx -purge=force
stack -mysql -purge=keep-data

Component Details

Nginx Installation

When installing Nginx, the following is configured:
  • Official Nginx repository
  • Optimized nginx.conf
  • FastCGI cache setup
  • Security headers
  • Default site
  • Admin tools site
  • SSL certificate for default site
  • kTLS module support
  • Gzip compression
  • Brotli compression (if available)
Files created:
  • /etc/nginx/nginx.conf - Main configuration
  • /etc/nginx/sites-available/ - Site configurations
  • /etc/nginx/sites-enabled/ - Enabled sites
  • /etc/nginx/common/ - Common configuration includes
  • /var/www/ - Web root directory
  • /var/run/nginx-cache/ - FastCGI cache directory

PHP Installation

When installing PHP, the following is configured:
  • Ondřej Surý’s PHP PPA (Ubuntu)
  • PHP-FPM with optimized settings
  • Required PHP extensions:
    • php-fpm - FastCGI Process Manager
    • php-common - Common files
    • php-cli - Command-line interface
    • php-curl - cURL support
    • php-gd - GD graphics library
    • php-imap - IMAP support
    • php-readline - Readline support
    • php-mysql - MySQL/MariaDB support
    • php-mbstring - Multibyte string support
    • php-bcmath - BCMath arbitrary precision mathematics
    • php-zip - ZIP archive support
    • php-xml - XML support
    • php-soap - SOAP support
    • php-imagick - ImageMagick support
    • php-msgpack - MessagePack support
    • php-igbinary - Igbinary support
    • php-intl - Internationalization support
    • php-opcache - Zend OPcache (PHP 5.6-8.4)
PHP-FPM configuration:
  • Pool configuration at /etc/php/{ver}/fpm/pool.d/www.conf
  • php.ini at /etc/php/{ver}/fpm/php.ini
  • PHP info page at tools site
  • PHP status page at tools site

MySQL/MariaDB Installation

MariaDB (default):
  • Official MariaDB repository
  • Secure installation
  • Root and admin users created
  • Optimized configuration
MySQL:
  • Official MySQL repository
  • Secure installation
  • Root and admin users created
  • Optimized configuration
Configuration files:
  • /etc/mysql/my.cnf - Main configuration
  • /etc/mysql/conf.d/ - Additional configurations
  • /var/lib/mysql/ - Data directory
Credentials storage:
  • Root password stored in Webinoly config
  • Admin user for Webinoly operations
  • MySQL client login file at ~/.my.cnf

Let’s Encrypt Installation

Installs Certbot snap package with:
  • Automatic certificate renewal
  • Cron job for renewals (runs twice daily)
  • DNS plugins available
  • HTTP-01 and DNS-01 challenge support

Backup Tools Installation

Installs:
  • Duplicity - Encrypted bandwidth-efficient backup
  • Duply - Frontend for duplicity
  • python3-boto3 - AWS S3 support
Configuration:
  • Profiles stored at ~/.duply/
  • Supports local and S3 backups
  • Encryption supported

Postfix Installation

Installs Postfix configured as:
  • Internet Site mode
  • Local delivery disabled
  • SMTP relay support
  • Sendmail compatibility
Configuration:
  • Main config at /etc/postfix/main.cf
  • Enables PHP mail() function

Redis Installation

Installs:
  • Redis server (latest from Redis PPA)
  • PHP Redis extension
  • Persistent storage configuration
  • Unix socket for PHP-FPM
Configuration:
  • Config at /etc/redis/redis.conf
  • Socket at /var/run/redis/redis-server.sock
  • Default maxmemory policy: allkeys-lru

Memcached Installation

Installs:
  • Memcached server
  • PHP Memcached extension
  • PHP Memcache extension (legacy, PHP 5.6-8.4)
Configuration:
  • Config at /etc/memcached.conf
  • Default memory: 64MB
  • Unix socket support

phpMyAdmin Installation

Installs:
  • Latest phpMyAdmin
  • Blowfish secret configured
  • TempDir configured
  • Access via tools site
Location:
  • /var/www/{tools-site}/htdocs/pma/
  • Access at https://{tools-site}/pma/

Common Usage Examples

Install complete LEMP stack

stack -lemp

Install Nginx and PHP only

stack -php=nginx

Add Redis to existing installation

stack -redis

Upgrade PHP version

stack -php-ver=8.3

Upgrade MariaDB version

stack -mysql-ver=11.8

Install minimal stack (for Docker)

stack -lemp -build=light

Remove Nginx keeping sites data

stack -nginx -purge=keep-data

Remove entire stack

stack -purge-server-all

Install backup tools

stack -backups

Install phpMyAdmin

stack -pma

Version Compatibility

PHP Version Support

VersionStatusUbuntu Support
5.6LegacyAll versions
7.0LegacyAll versions
7.1LegacyAll versions
7.2LegacyAll versions
7.3LegacyAll versions
7.4MaintenanceAll versions
8.0SecurityAll versions
8.1ActiveAll versions
8.2ActiveAll versions
8.3ActiveAll versions
8.4ActiveAll versions
8.5CurrentAll versions

MySQL Version Support

VersionStatusArchitecture
8.0LTSx86_64 only
8.4Innovationx86_64 only
9.1Innovationx86_64 only
9.2Innovationx86_64 only
Note: MySQL does not support ARM processors.

MariaDB Version Support

VersionStatusSupport Until
10.5MaintenanceJune 2025
10.6LTSJuly 2026
10.11LTSFebruary 2028
11.4LTSMay 2029
11.8Current-

Stack Removal Behavior

Nginx Removal

Standard removal:
  • Removes all sites
  • Removes Let’s Encrypt certificates
  • Removes phpMyAdmin
  • Removes backup tools
  • Removes all configuration
  • Removes /var/www/ directory
With keep-data:
  • Removes Nginx package
  • Keeps sites data in /var/www/
  • Keeps site configurations
  • Keeps SSL certificates
  • Can be reinstalled later

PHP Removal

Removes:
  • PHP-FPM and all extensions
  • Postfix (if installed)
  • Redis (if installed)
  • Memcached (if installed)
  • phpMyAdmin (depends on PHP)
  • SMTP configuration
  • PHP configuration files

MySQL/MariaDB Removal

Standard removal:
  • Removes all databases
  • Removes all users
  • Removes configuration files
  • Removes phpMyAdmin
  • Cannot be recovered
With keep-data:
  • Removes packages
  • Keeps data directory (/var/lib/mysql/)
  • Keeps configuration
  • Can be reinstalled later
  • Important: Make backups before reinstalling

Build docs developers (and LLMs) love