====== Панель управления хостингом cPanel/WHM ====== {{:web:cpanel_logo.png?400&nolink|}} [[https://documentation.cpanel.net/display/ALD/Installation+Guide+-+System+Requirements|{{:web:cpanel_system_requirements.png?200|}}]] [[https://documentation.cpanel.net/display/ALD/Installation+Guide+-+Customize+Your+Installation|{{:web:cpanel_customize.png?200|}}]] [[https://documentation.cpanel.net/display/ALD/Installation+Guide+-+Troubleshoot+Your+Installation|{{:web:cpanel_troubleshoot.png?200|}}]] [[https://documentation.cpanel.net/display/ALD/Installation+Guide+-+cPanel+DNSONLY+Installation|{{:web:cpanel_dns_only.png?200|}}]] [[https://documentation.cpanel.net/pages/viewpage.action?pageId=1507786|{{:web:cpanel_whm.png?200|}}]] [[https://documentation.cpanel.net/display/ALD/Installation+FAQ|{{:web:cpanel_faqs.png?200|}}]] ===== CloudLinux ===== * http://docs.cloudlinux.com/index.html?limits.html * http://docs.cloudlinux.com/index.html?converting_existing_servers.html * https://wiki.mikejung.biz/CloudLinux * https://jparks.work/index.php?title=EasyApache * http://docs.kernelcare.com/index.html * http://web.archive.org/web/20160121104946/https://www.watters.ws/mediawiki/index.php/Apache_Optimization#For_Storm_and_Dedicated_Server_with_between_16G_and_32G_of_RAM ===== HowTo ===== ==== Отключить 2FA для root ==== Выполнить скрипт ([[https://documentation.cpanel.net/display/DD/WHM+API+1+Functions+-+twofactorauth_disable_policy|cpanel doc]]) whmapi1 twofactorauth_disable_policy --- metadata: command: twofactorauth_disable_policy reason: OK result: 1 version: 1 ==== Как принудительно запустить бэкап ==== Если бэкап уже есть, но нужно сделать его заново /usr/local/cpanel/bin/backup --force Для старой/legacy системы бэкапа команда такая /usr/local/cpanel/scripts/cpbackup --force ==== HSTS ==== Чтобы был forward secrecy в whm добавляем в pre main include Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains;" ==== PostgreSQL и php_pgsql ==== Нужен PHP-модуль pgsql, чтобы делать простой pg_connect. Через EasyApache3 перекомпилировать PHP не получается, так как ему [[https://documentation.cpanel.net/display/EA/PHP+Module%3A+Pgsql|нужен установленный PGSQL сервер]] The last time Cpanel::Easy::PHP5::Pgsql was run; step returned 0. That just caused Cpanel::Easy::PHP5::Pgsql to be skipped. The message it gave was: Unable to find postgresql path You might want to take that into consideration when choosing options and troubleshooting. The log for that build no longer exists. Через PECL установить также нельзя pear/MDB2_Driver_pgsql requires PHP extension "pgsql" PGSQL [[https://documentation.cpanel.net/display/CKB/Install+or+Update+PostgreSQL+on+Your+cPanel+Server|ставим по рекомендациям]] разработчиков cPanel - Установить **/usr/local/cpanel/scripts/installpostgres** - Настроить **Home >> SQL Services >> Configure Postgres** Пересобираем PHP через EasyApache3. Проверяем pg_connect [[https://stackoverflow.com/questions/32700618/simple-test-php-with-postgresql-database|например так]] Всё. ==== Как завершить процесс бэкапа ==== Смотрим процесс # ps -aux | grep pkgacct И варварски убиваем # kill -9 PID ==== Настройщик рояля ==== * Turning Mailman off – WHM → Server Configuration → Tweak Settings → off * Number of minutes between mail server queue runs (default is 60) – Setting it 120 * Default catch-all/default address behavior for new accounts” to fail * Boxtrapper Spam Trap and SpamAssassin Spam Box delivery – off * Analog Stats – off * Conserve Memory at the expense of using more cpu/diskio – turn on * WHM >> Service Configuration >> FTP Server Configuration – Check ‘no’ to ‘allow anonymous logins and ‘no’ to ‘anonymous uploads’ * WHM >> cPanel >> Manage Plugins – install spamdconf – then go to ‘Setup Spamd Startup Configuration’ – select option 2 ‘Maximum Children” to 2′ * Run your cron jobs at off peak hours. * Install e Accelerator PHP accelerator (Recompile Apache with eAccelerator) * Compiling Apache with mod_deflate Gzip Module * Running Apache with the thread-based “Worker” MPM instead of the default “Prefork” MPM ==== DNSOnly ==== cPanel/WHM документация * [[https://documentation.cpanel.net/display/CKB/Guide+to+DNS+Cluster+Configurations|Guide to DNS Cluster Configurations - cPanel Knowledge Base - cPanel Documentation]] * [[https://documentation.cpanel.net/display/ALD/DNS+Cluster|DNS Cluster - Documentation - cPanel Documentation]] Наверное рабочие мануалы. Не проверял - всё заработало из коробки без бубнов и подсказок. * https://lowendbox.com/blog/handle-dns-properly-with-cpanel/ * https://moccagarden.com/setting-up-a-cpanel-dnsonly-server-part-2/ * http://lucrussell.com/how-to-set-up-clustered-dns-with-cpanel-dns-only/ * [[https://forums.cpanel.net/threads/cpanel-dns-cluster-setup-w-2x-cpanel-dns-only-vps.234252/#post1040321|cPanel DNS Cluster setup (/w 2x cPanel DNS Only VPS)]] TL;DR На DNSOnly cерверах синхронизацию с cPanel серверами отключаем и ставим для всех серверов Standalone. В cPanel ставим Synchronize Changes. ==== Disk usage warning ==== {{:web:cpanel_disk_usage_warning.png?nolink&600|}} * [[https://habrahabr.ru/sandbox/76322/|Чистим и увеличиваем папку /tmp в Cpanel]] * [[https://documentation.cpanel.net/display/ALD/The+Securetmp+Script|The Securetmp script]] * ==== Что за странный процесс lfd? ==== Если на сервере установлен [[http://configserver.com/cp/csf.html|CSF]] (Config Server Firewal), то значит есть демон Login Failure Daemon (lfd), который входит в состав CSF. На почту администратора cPanel сервера при этом приходят разные раздражающие сообщения Virtual Memory Size excessive resource usage alert, Process Time excessive resource usage alert и другие. lfd on cpanel.foobar.com: WHM/cPanel root access alert from 188.111.13.13 (RU/Russian Federation/cool.reverse-dns.net) Time: Wed Dec 23 14:26:57 2015 +0100 IP: 188.111.13.13 (RU/Russian Federation/cool.reverse-dns.net) User: root Ставим повыше значения для PT_USERTIME и PT_USERMEM (чтобы отключить ставим равным нулю). Для применения изменений выполняем команду ''csf -r'' ==== Смотрим кто больше всего отправляет писем ==== Источник: http://notes.sys4n.com/?p=598 # grep cwd /var/log/exim_mainlog | awk '/public_html/ {print $3}' | sort | uniq -c в результате будет список юзеров и путь к директориям, кто сколько разослал 16 cwd=/home/xxxx/public_html 6 cwd=/home/yyyy/public_html 1 cwd=/home/zzzz/public_html/alko 20 cwd=/home/aaaaa/public_html/forum2 ==== Где какие логи находятся ==== http://go.cpanel.net/logposter ({{ :web:cpanel_logs_location.pdf |зеркало rtfm.wiki pdf}}) **cPanel logs** |Access logs and user actions |/usr/local/cpanel/logs/access_log | |Account transfers and misc. logs |/var/cpanel/logs | |Auditing log (account creations, deletions, etc) |/var/cpanel/accounting.log | |Backup logs |/usr/local/cpanel/logs/cpbackup | |Brute force protection (cphulkd) log |/usr/local/cpanel/logs/cphulkd.log | |Cpanel dnsadmin dns clustering daemon |/usr/local/cpanel/logs/dnsadmin_log | |Cpanel taskqueue processing daemon |/usr/local/cpanel/logs/queueprocd.log | |DBmapping |/usr/local/cpanel/logs/setupdbmap_log | |EasyApache build logs |/usr/local/cpanel/logs/easy/apache/ | |Error log |/usr/local/cpanel/logs/error_log | |Installation log |/var/log/cpanel | |License updates and errors |/usr/local/cpanel/logs/license_log | |Locale database modifications |/usr/local/cpanel/logs/build_locale_database_log | |Login errors (CPSRVD) |/usr/local/cpanel/logs/login_log | |Horde |/var/cpanel/horde/log/ | |RoundCube |/var/cpanel/roundcube/log/ | |SquirrelMail |/var/cpanel/squirrelmail/ | |Panic log |/usr/local/cpanel/logs/panic_log | |Per account bandwidth history (Cached) |/var/cpanel/bandwidth.cache/{USERNAME} | |Per account bandwidth history (Human Readable) |/var/cpanel/bandwidth/{USERNAME} | |Service status logs |/var/log/chkservd.log | |Tailwatch driver tailwatchd log |/usr/local/cpanel/logs/tailwatch_log | |Update analysis reporting |/usr/local/cpanel/logs/updated_analysis/{TIMESTAMP}.log | |Update (UPCP) log |/var/cpanel/updatelogs/updated.{TIMESTAMP}.log | |WebDisk (CPDAVD) |/usr/local/cpanel/logs/cpdavd_error_log | |Website statistics log |/usr/local/cpanel/logs/stats_log | **cPanel access log** |Access logs and user actions |/usr/local/cpanel/logs/access_log | **cPanel apache log** |Apache restarts done through cPanel and WHM |/usr/local/cpanel/logs/safeapcherestart_log | |Domain access logs |/usr/local/apache/domlogs/{DOMAIN} | |Processing of log splitting |/usr/local/cpanel/logs/splitlogs_log | |suPHP audit log |/usr/local/apache/logs/suphp_log | |Web server and CGI application error log |/usr/local/apache/logs/error_log | **cPanel email log** |Delivery and receipt log |/var/log/exim_mainlog | |Incoming mail queue |/var/spool/exim/input/ | |Log of messages rejected based on ACLS or other policies |/var/log/exim_rejectlog | |Unexpected/Fatal error log |/var/log/exim_paniclog | |IMAP, POP login attempts, transactions, fatal errors and spam scoring |/var/log/maillog |/var/log/messages | |Mailman |/usr/local/cpanel/3rdparty/mailmain/logs | **MySQL** |MySQL error log |/var/lib/mysql/{SERVER_NAME}.err | |MySQL slow query log (if enabled in my.cnf) |/var/log/slowqueries | ==== Как починить права на юзер аккаунтах ==== #!/bin/bash for user in `ls /var/cpanel/users`; do chown ${user}:${user} /home/${user}/public_html chmod 755 /home/${user}/public_html find /home/${user}/public_html -group nobody -print0 | xargs -0 chgrp ${user} find /home/${user}/public_html -type f -print0 | xargs -0 chmod 644 find /home/${user}/public_html -type d -print0 | xargs -0 chmod 755 done ==== Как проверить все базы MySQL ==== # mysqlcheck --all-databases -r #repair # mysqlcheck --all-databases -a #analyze # mysqlcheck --all-databases -o #optimize ==== Где найти пароль MySQL? ==== /root/.my.cnf ==== Firewall, список открытых портов по-умолчаниюя в cPanel ==== [[https://documentation.cpanel.net/display/CKB/How+to+Configure+Your+Firewall+for+cPanel+Services|How to Configure Your Firewall for cPanel Services]] {{:web:cpanel_fw.png?700|}} ==== PHP handlers ==== Для истории {{:web:cpanel_php_handlers.png?nolink&600|}} ==== Nginx reverse proxy ==== Для nginx есть несколько сторонних решений, которые добавляют поддержку nginx в панель * https://engintron.com FREE * http://www.nginxcp.com FREE * https://cpnginx.com ($5/mo/server, life time $249/server) ===== Ошибки ===== ==== virtual_aliases: No Such User Here ==== Вероятно MX расположены вне cPanel сервера. Поэтому ставим **Remote Mail Exchanger** в разделе **cPanel → Mail → MX Entry**. ==== Включить ini_set ==== Ошибка **ini_set() has been disabled for security reasons** Drupal при попытке войти на сайт выдает **You are not authorized to access this page**. В логах Warning: ini_set() has been disabled for security reasons in drupal_environment_initialize() (line 700 of /home/user/public_html/foobar.com/includes/bootstrap.inc). Warning: ini_set() has been disabled for security reasons in include_once() (line 334 of /home/user/public_html/foobar.com/sites/default/settings.php). Warning: ini_set() has been disabled for security reasons in drupal_settings_initialize() (line 806 of /home/user/public_html/foobar.com/includes/bootstrap.inc). ini_set добавлен в disable_functions, как наверное понятно для безопасности. Drupal 8 увы не работает без ini_set'а. Вероятно можно через htaccess задать необходимые параметры для PHP. Поискать в коде ini_set можно как-то так. TODO проверить find /home/path -type f -name "*.php" -print0 | xargs -0 grep -l ini_set Что делать не надо, так как не помогает если у вас DSO * http://mybyways.com/blog/grav-with-php-5-6-ini_set-fix * https://forums.cpanel.net/threads/ini_set-disable-functions.424451/#post-1716541 Если нет возможности вместо DSO перейти на suPHP, [[https://forums.cpanel.net/threads/how-to-override-php_functions-in-htaccess-dso-not-suphp.433461/#post-1754611|то извините]] //The only other alternative (besides switching to suPHP) is to remove the option from the disable_functions list globally.// ==== Unable to send “/backup/ accounts/ -=-meta” to destination ==== Ошибки (transport_errors.txt) {{:web:cpanel_transport_errors_1.png?nolink|}} {{:web:cpanel_transport_errors_2.png?nolink|}} Решение (увеличить тайм-аут для удаленного хранилища). Backup → Backup Configuration → Additional Destinations → Edit → Timeout {{:web:cpanel_backup_timeout.png?nolink|}} По-умолчанию было 90 секунд. ==== Релиз 66.0.17 внезапно ломает mod_rewrite и htaccess ==== * [[https://forums.cpanel.net/threads/mod_userdir-broken-since-cpanel-66.608887/|mod_userdir broken since cPanel 66]] * [[https://forums.cpanel.net/threads/latest-cpanel-update-causes-404-errors.608611/#post-2470059|Latest cPanel Update causes 404 errors]] * [[https://forums.cpanel.net/threads/mod_rewrite-does-not-work-after-upgrade-to-v66-0-15.609247/|Mod_rewrite does not work after upgrade to v66.0.15]] * [[https://forums.cpanel.net/threads/websites-down-after-enabling-htaccess-optimization-feature-in-cpanel-66.606383/ |Websites down after enabling ".htaccess Optimization" feature in cPanel 66]] Вот почему надо использовать только **Manual Updates Only** в **Update Preferences**. Временное решение: WHM >> Home >> Service Configuration >> Apache Configuration >> Global Configuration" and temporarily set "Optimize .htaccess (AllowOverride)" to "Search "/" and below (No optimization, Search Full Path)". ==== Не работает статистика Apache в Munin после установки nginxcp ==== Порт Apache изменился на 8081 В файл ''/etc/munin/plugin-conf.d/cpanel.conf'' добавляем [apache_*] env.url http://127.0.0.1:%d/whm-server-status?auto env.ports 8081 ==== Munin: MySQL InnoDB free tablespace WARN ==== https://forums.cpanel.net/threads/munin-plugin-warn-mysql-innodb-free-tablespace.208591/ Можно просто отключить такие алерты В файл ''/etc/munin/plugin-conf.d/mysql_innodb'' добавляем [mysql_innodb] env.warning 0 env.critical 0 и перезапускаем munin-node /etc/init.d/munin-node restart ==== spamd сильно нагружает CPU ==== Запустить скрипт ''spamd_dbm_fix'' /scripts/autorepair spamd_dbm_fix После перезапустить exim # /etc/init.d/exim restart Также можно запустить скрипт через браузер - http://IP:2086/scripts2/autofixer или даже так http://IP:2086/scripts2/doautofixer?autofix=spamd_dbm_fix Коллекция скриптов для автопочинки доступна [[http://httpupdate.cpanel.net/autofixer/|здесь]] ==== lfd on my.foobar.com: Excessive resource usage: account_name ==== {{:web:cpanel_excessive_resource_usage.png?nolink|}} Открываем в cPanel: Plugins → ConfigServer Security & Firewall. Находим "lfd – Login Failure Daemon" В выпадающем меню **csf.ignore – IP Blocking** выбираем **csf.pignore - Process Tracking**, далее **Edit**. Добавляем exe:/opt/cpanel/ea-php55/root/usr/bin/php-cgi exe:/opt/cpanel/ea-php56/root/usr/bin/php-cgi exe:/opt/cpanel/ea-php70/root/usr/bin/php-cgi exe:/opt/cpanel/ea-php71/root/usr/bin/php-cgi И нажимаем **Restart LFD**. ==== Excessive resource usage: munin ==== На почту приходят подобные сообщения Time: Wed Aug 31 09:15:09 2016 +0200 Account: munin Resource: Virtual Memory Size Exceeded: 215 > 200 (MB) Executable: /usr/local/cpanel/3rdparty/perl/522/bin/perl Command Line: /usr/local/cpanel/3rdparty/perl/522/bin/perl -w /usr/local/cpanel/3rdparty/share/munin/munin-update PID: 23481 (Parent PID:23479) Killed: No Можно увеличить лимит виртуальной памяти по достижении которого LFD отсылает уведомление. Для этого нужно изменить значение ''PT_USERMEM'' в файле ''/etc/csf/csf.conf'' если вы работаете в SSH либо в CSF → ConfigServer Firewall → Firewall Configuration Чтобы отключить уведомления для пользователя munin нужно добавить строку ''user:munin'' в файл игнорирования процессов (как сложно порой перевести на русский язык некоторые фразы process ignore file). В WHM перейти в секцию LFD () и выбрать ''csf.pignore Process Tracking'' в выпадающем списке. Далее в конец файла добавить ''user:munin'' Либо если вы работаете через SSH, то добавьте строку в файл ''/etc/csf/csf.pignore'' {{:web:cpanel_lfd_munin.png?600|}} ==== Error from park wrapper ==== Домен уже соответствует IP-адресу, который не использует серверы имен, связанные с этим сервером. Перенесите домен на серверы имен этого сервера или попросите администратора добавить один из его серверов имен в файл ''/etc/ips.remotedns'' и внести надлежащие записи типа А на этом удаленном сервере имен. **Ошибка** Error from park wrapper: Не удается определить IP-адреса сервера имен. Убедитесь в том, что домен зарегистрирован у действующего регистратора доменов. Error from park wrapper: Sorry, cannot determine nameserver IPs. Please make sure that the domain is registered with a valid domain registrar. **Причина:** для домена не установлены NS cPanel сервера. **Решение:** в WHM Tweak Settings активировать опции (нежелательно) * Allow Creation of Parked/Addon Domains that are not registered - разрешить добавлять незарегистрированные домены * **Allow Remote Domains** (Allow Creation of Parked/Addon Domains that resolve to other servers) - разрешить добавлять домены делегированные на сторонние NS ==== "Fatal error: Incompatible file format: The encoded file has format major ID 1, whereas the Loader expects 5" ==== Сайт\файлы не совместимы с текущей версией загрузчика Zend. Эта ошибка появляется, когда вы кодировали сайт с помощью Zend Encoder для более низкой версии PHP и пытаетесь запустить его в более высокой версии PHP. Т.е. вы пытаетесь выполнить закодированный в PHP 5.2 файл на PHP 5.3 Что можно сделать: - Понизить версию PHP на сервере до требуемой более низкой версии. - Перекодировать PHP файлы для работы с последней версией PHP. ==== Error from park wrapper: domain.com is owned by another user ==== * http://www.linuxspy.info/189/error-from-park-wrapper-domain-com-is-owned-by-another-user/ * http://www.thecpaneladmin.com/resolving-domain-park-wrapper-errors/ * http://www.cpanelblog.in/error-from-domain-wrapper-domain-com-is-owned-by-another-user * http://www.elinux.co.in/error-from-park-wrapper-domain-com-is-owned-by-another-user/ * http://kb.westhost.com/questions/452/%22Error+from+Park+Wrapper%3A+domain+owned+by+another+user%22+when+creating+Addon+Domain ===== Плагины ===== * http://www.whmxtra.com * https://www.jetapps.com/jetbackup * http://www.litespeedtech.com/products/control-panel-plugins/cpanel-whm-plugin * https://www.whmsonic.com * https://www.cloudlinux.com * http://thecpaneladmin.com/plugin-database/ * https://www.ndchost.com/cpanel-whm/addons/accountdnscheck/ ===== Ссылки ===== * https://docs.danami.com/juggernaut/settings/login-failure-daemon/login-failure-blocking * https://blog.stickleback.dk/cpremote-cpanel-backup/ * [[https://forums.cpanel.net/threads/troubleshooting-high-server-loads-on-linux-servers.319352/|Troubleshooting high server loads on Linux servers]] * [[https://confluence2.cpanel.net/display/CKB/Product+Versions+and+the+Release+Process|Product Versions and the Release Process]] * [[http://www.tppwholesale.com.au/support/how-do-i-integrate-my-cpanel-whm-to-whmcs/|How do I integrate my cPanel WHM to WHMCS?]] * http://wiki.whmcs.com/Products_and_Services#Module_Settings_.28aka_Provisioning.29 * [[http://docs.whmcs.com/CPanel/WHM#No_user_name_supplied:_.22username.22_is_a_required_argument|No user name supplied: "username" is a required argument]] * [[http://support.hostgator.com/articles/cpanel/what-is-the-difference-between-parked-addon-and-subdomains|What is the Difference between Parked, Addon and Subdomains?]] * [[https://dpkarthi.wordpress.com/2013/09/23/cpanel-exam-questions-and-answers/|Cpanel Exam Questions and Answers]] * https://github.com/thecamels/zabbix#template-app-cpanel * https://www.hostdime.com/resources/csf-ssh-command-line-commands/ * https://documentation.cpanel.net/display/68Docs/Customization * https://documentation.cpanel.net/display/EA4/PHP+Handlers * https://documentation.cpanel.net/display/EA4/PHP+Options#PHPOptions-PHPextensions * https://documentation.cpanel.net/display/CKB/cPanel+Deprecation+Plan * https://github.com/tripflex/cpsetup