# Plesk Control Panel Reference This document maps Plesk paths and structures for toolkit compatibility. ## Plesk Detection ```bash # Version file /usr/local/psa/version # Admin bin directory /usr/local/psa/bin/ # CLI tool /usr/local/psa/bin/plesk ``` ## Directory Structure ### User/Domain Home Base ``` /var/www/vhosts/ ``` **Structure:** ``` /var/www/vhosts/ ├── domain.com/ # Main domain directory │ ├── httpdocs/ # Public web root │ ├── httpsdocs/ # SSL web root (if separate) │ ├── cgi-bin/ │ ├── private/ │ ├── logs/ # (FUTURE: will move here in Plesk Obsidian 18.0.50+) │ ├── statistics/ │ └── tmp/ ├── subdomain.domain.com/ # Subdomain (separate directory) │ ├── httpdocs/ │ └── ... └── system/ # System directory (logs, configs) ├── domain.com/ │ ├── logs/ # Current location of access/error logs │ ├── conf/ # Apache/Nginx configs │ ├── etc/ # PHP.ini and other configs │ └── php-fpm.sock # PHP-FPM socket └── subdomain.domain.com/ └── ... ``` ### Log Files **Current Structure (Plesk 17.x - 18.0.49):** ``` /var/www/vhosts/system/DOMAIN/logs/ ├── access_log # HTTP access log ├── access_ssl_log # HTTPS access log ├── error_log # Error log (both HTTP/HTTPS) ├── proxy_access_log # Nginx proxy access (if applicable) ├── proxy_access_ssl_log # Nginx proxy HTTPS access └── proxy_error_log # Nginx proxy errors ``` **Future Structure (Plesk Obsidian 18.0.50+):** ``` /var/www/vhosts/DOMAIN/logs/ ├── access_log ├── access_ssl_log ├── error_log └── ... ``` ### Configuration Files **Per-Domain Configs:** ``` /var/www/vhosts/system/DOMAIN/conf/ ├── httpd.conf # Apache vhost config ├── nginx.conf # Nginx config ├── vhost.conf # Custom Apache directives ├── vhost_ssl.conf # Custom SSL directives └── php.ini # In ../etc/php.ini ``` **PHP Configuration:** ``` /var/www/vhosts/system/DOMAIN/etc/ └── php.ini # Domain-specific PHP settings ``` ### PHP-FPM **Pool Sockets:** ``` /var/www/vhosts/system/DOMAIN/php-fpm.sock ``` **System PHP-FPM:** ``` /opt/plesk/php/X.Y/ # Plesk-managed PHP versions /usr/bin/php # System default PHP ``` ## Plesk CLI Commands ### Domain Management ```bash # List all domains plesk bin domain --list # Get domain info plesk bin domain --info DOMAIN # Get domain document root plesk bin domain --info DOMAIN | grep "www root" | awk '{print $NF}' ``` ### User/Subscription Management ```bash # List all subscriptions plesk bin subscription --list # Get subscription info plesk bin subscription --info DOMAIN # List users plesk bin user --list ``` ### Database Management ```bash # List databases plesk bin database --list # List databases for domain plesk bin database --list -domain DOMAIN ``` ### Log Files ```bash # Get log file path for domain # Current: /var/www/vhosts/system/DOMAIN/logs/ # Future: /var/www/vhosts/DOMAIN/logs/ ``` ### PHP Version Detection ```bash # List PHP handlers plesk bin php_handler --list # Get domain PHP version plesk bin site --info DOMAIN | grep "PHP version" ``` ### Service Management ```bash # Apache plesk bin service_node --start httpd plesk bin service_node --stop httpd plesk bin service_node --restart httpd # Nginx plesk bin service_node --start nginx plesk bin service_node --stop nginx # PHP-FPM plesk bin service_node --restart plesk-php*-fpm ``` ## User/Domain Discovery ### Finding All Domains ```bash # Method 1: Using Plesk CLI plesk bin domain --list # Method 2: Directory scan ls -1d /var/www/vhosts/*/ | grep -v "system\|chroot\|.skel\|default" | xargs -I{} basename {} # Method 3: From system directory ls -1 /var/www/vhosts/system/ | grep -v "^[0-9]" ``` ### Finding Domain Owner ```bash # Get subscription owner plesk bin subscription --info DOMAIN | grep "Owner's login" ``` ### Finding Document Roots ```bash # Main domain /var/www/vhosts/DOMAIN/httpdocs # Subdomains /var/www/vhosts/SUBDOMAIN.DOMAIN/httpdocs # Via CLI plesk bin domain --info DOMAIN | grep "www root" ``` ## PHP Detection ### Plesk-Managed PHP Versions ```bash # Location /opt/plesk/php/*/bin/php # List all versions ls -1d /opt/plesk/php/*/bin/php 2>/dev/null # Get versions for php in /opt/plesk/php/*/bin/php; do $php -v | head -1 done ``` ### System PHP ```bash /usr/bin/php php -v ``` ## Database Discovery ### MySQL/MariaDB ```bash # Plesk stores DB mappings in: /var/lib/psa/dumps/ # Get databases via CLI plesk bin database --list # Database naming convention DOMAIN_DBNAME (underscores replace dots) ``` ## Subdomain Handling **Important:** Plesk creates separate directories for subdomains ```bash # Main domain /var/www/vhosts/domain.com/httpdocs # Subdomain gets its own directory /var/www/vhosts/sub.domain.com/httpdocs # Logs /var/www/vhosts/system/sub.domain.com/logs/ ``` ## Email ### Mailboxes ```bash # Location /var/qmail/mailnames/DOMAIN/USERNAME/Maildir/ ``` ### Mail Logs ```bash /var/log/maillog ``` ## Important Differences from cPanel 1. **No /home directory structure** - Uses /var/www/vhosts 2. **Subdomains are separate** - Not under main domain's directory 3. **Logs in system/** - Not in domain directory (until Plesk 18.0.50+) 4. **PHP-FPM per domain** - Socket in system/DOMAIN/ 5. **No ea-php** - Uses /opt/plesk/php/X.Y/ 6. **CLI is different** - Uses `plesk bin` not WHM API 7. **User != Domain** - Subscription owners, not cPanel users ## Toolkit Compatibility Requirements ### Path Variables ```bash SYS_USER_HOME_BASE="/var/www/vhosts" SYS_LOG_DIR="/var/www/vhosts/system" ``` ### Domain Enumeration Must use: 1. `plesk bin domain --list` 2. Directory scan excluding: system, chroot, .skel, default, fs ### Log File Discovery ```bash # Current Plesk find /var/www/vhosts/system/*/logs/ -name "access*log" -o -name "error_log" # Future Plesk (18.0.50+) find /var/www/vhosts/*/logs/ -name "access*log" -o -name "error_log" ``` ### PHP-FPM Pool Discovery ```bash # Find all PHP-FPM pools find /var/www/vhosts/system/*/php-fpm.sock -type s 2>/dev/null # Or check config grep -r "listen = " /var/www/vhosts/system/*/etc/ 2>/dev/null ``` ## Version-Specific Notes ### Plesk Obsidian (18.0.x) - Version 18.0.50+ moves logs from system/DOMAIN/logs/ to DOMAIN/logs/ - Toolkit should check both locations for compatibility ### Plesk Onyx (17.x) - Logs in system/DOMAIN/logs/ - Stable structure