Plesk¶
Commande plesk:¶
~# plesk
Usage: plesk [command]
Commands:
bin - Run the specified Plesk command-line utility (e.g., domain, client)
conf - Open the specified Plesk configuration file in the editor
daily - Run daily maintenance script
db - Database related commands. Open MySQL console by default.
ext - Call a command-line interface of the specified Plesk extension
help - Show help and exit
installer - Parallels Installer shortcuts and command completion
log - Open the specified Plesk configuration file in the editor
login - generate login link for specified user
php - Run a PHP script using the Plesk PHP interpreter
repair - Check and repair Plesk
sbin - Run the specified Plesk internal utility
version - Show product version information
plesk installer --select-release-current --install-component php7.2
Réparer Plesk:¶
$ plesk installer --select-release-current --reinstall-patch --upgrade-installed-components
$ plesk repair installation
Tester la zone DNS:¶
# plesk bin dns --info maboiteverte.fr
www.maboiteverte.fr. CNAME maboiteverte.fr.
_dmarc.maboiteverte.fr. TXT v=DMARC1; p=none
maboiteverte.fr. TXT v=spf1 +a +mx +a:localhost.localdomain -all
ftp.maboiteverte.fr. CNAME maboiteverte.fr.
ipv4.maboiteverte.fr. A 212.227.191.167
mail.maboiteverte.fr. A 212.227.191.167
maboiteverte.fr. MX 10 mail.maboiteverte.fr.
webmail.maboiteverte.fr. A 212.227.191.167
maboiteverte.fr. A 212.227.191.167
ns2.maboiteverte.fr. A 212.227.191.167
maboiteverte.fr. NS ns2.maboiteverte.fr.
ns1.maboiteverte.fr. A 212.227.191.167
maboiteverte.fr. NS ns1.maboiteverte.fr.
SUCCESS: Getting information for Domain 'maboiteverte.fr' complete.
Liste des extensions installées:¶
plesk bin extension --list
Réparer Plesk :¶
plesk repair installation
Réparer les permissions d'un site:¶
plesk repair fs example.com
Fichiers logs:¶
/var/www/vhosts/sur-le-sentier.fr/logs/
Ajouter l'user
bruno au groupe sudo
:¶
# ubuntu:
root@localhost:~# usermod -aG sudo bruno
Redémarrer MySQL / MariaDB:¶
# sous root:
service mysql restart || service mariadb restart || service mysqld restart
Redémarrer PHP:¶
# sous root:
plesk bin php_handler --list | grep -E plesk.*fpm | awk -F" " '{ print $1 }' | while read i; do service $i restart; done
Liste des modules installés:¶
# apache2ctl -M
Loaded Modules:
core_module (static)
so_module (static)
Vérifier la syntaxe du fichier de configuration:
# apachectl -t
# apachectl configtest
Syntax OK
https://httpd.apache.org/docs/2.4/fr/programs/apachectl.html
Installer GeoIP:¶
apt-get install plesk-php74-dev build-essential
apt-get install libgeoip-dev geoip-bin geoip-database
/opt/plesk/php/7.4/bin/pecl install http://pecl.php.net/get/geoip-1.1.1.tgz
/opt/plesk/php/7.4/lib/php/modules/geoip.so
Add " extension=geoip.so" to php.ini file:
For PHP 7.0 modify file /opt/plesk/php/7.0/etc/php.ini
For PHP 7.1 modify file /opt/plesk/php/7.1/etc/php.ini
echo "extension=geoip.so" > /opt/plesk/php/7.4/etc/php.d/geoip.ini
/opt/plesk/php/7.4/etc/php.d# /opt/plesk/php/7.4/bin/php -m | grep geoip
<?php print_r(geoip_record_by_name('php.net')); ?>
Required database not available at /usr/share/GeoIP/GeoIPCity.dat"
Redémarrer Apache:
service apache2 restart
sinon redémarrer le serveur
Installer GeoIP 2:¶
wget https://github.com/maxmind/geoip-api-mod_geoip2/archive/1.2.10.tar.gz
tar -xzvf 1.2.10.tar.gz
cd geoip-api-mod_geoip2-1.2.10/
apxs -i -a -L/usr/local/lib -I/usr/local/include -lGeoIP -c mod_geoip.c
Installer dans
/usr/lib/apache2/modules/mod_geoip.so
Ne marche pas !!
root@localhost:~# df -h /tmp
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg00-lv01 47G 44G 1,2G 98% /
root@localhost:~# df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg00-lv01 47G 44G 1,2G 98% /
Remove backup logfiles:
# status change XX*24 hours ago.
find /var/log/plesk/PMM/ -name 'backup*' -type d -ctime +XX -exec rm -rf {} +;
Remove backup files:
find /var/lib/psa/dumps -name 'backup*' -type f -ctime +XX -exec rm -rf {} +;
Allocate additional disk space or remove unnecessary files in /var/lib/psa/dumps
.
find / -type f -size +200M -exec du -h {} + 2>/dev/null | sort -r -h
5,0G /var/lib/psa/dumps/domains/sur-le-sentier.fr/backup_user-data_2108080143.tgz
2,5G /var/www/vhosts/sur-le-sentier.fr/.wp-toolkit/snapshots/instance_files_2_52x7sld.zip
1,3G /var/lib/psa/dumps/domains/maboiteverte.fr/backup_user-data_2110310443.tgz
445M /var/www/vhosts/sur-le-sentier.fr/httpdocs/blog/wp-content/backups-hsmHO/backup_sur-le-sentier.fr-2021-08-28_00-30-sql-d1408.tar
445M /var/www/vhosts/sur-le-sentier.fr/httpdocs/blog/wp-content/backups-hsmHO/backup_sur-le-sentier.fr-2021-08-21_01-02-sql-30d72.tar
445M /var/www/vhosts/sur-le-sentier.fr/httpdocs/blog/wp-content/backups-hsmHO/backup_sur-le-sentier.fr-2021-08-13_21-16-sql-4a9e7.tar
444M /var/www/vhosts/sur-le-sentier.fr/httpdocs/blog/wp-content/backups-hsmHO/backup_sur-le-sentier.fr-2021-08-06_21-55-sql-e4946.tar
444M /var/www/vhosts/sur-le-sentier.fr/httpdocs/blog/wp-content/backups-hsmHO/backup_sur-le-sentier.fr-2021-07-31_00-58-sql-55db0.tar
444M /var/www/vhosts/sur-le-sentier.fr/httpdocs/blog/wp-content/backups-hsmHO/backup_sur-le-sentier.fr-2021-07-23_19-09-sql-f389e.tar
443M /var/www/vhosts/sur-le-sentier.fr/httpdocs/blog/wp-content/backups-hsmHO/backup_sur-le-sentier.fr-2021-09-18_00-06-sql-a7089.tar
443M /var/www/vhosts/sur-le-sentier.fr/httpdocs/blog/wp-content/backups-hsmHO/backup_sur-le-sentier.fr-2021-09-11_01-02-sql-43a2f.tar
442M /var/www/vhosts/sur-le-sentier.fr/httpdocs/blog/wp-content/backups-hsmHO/backup_sur-le-sentier.fr-2021-09-03_16-27-sql-24b6a.tar
357M /var/lib/fail2ban/fail2ban.sqlite3.20210913-061953
357M /var/lib/fail2ban/fail2ban.sqlite3.20210802-061844
357M /var/lib/fail2ban/fail2ban.sqlite3
272M /var/lib/psa/dumps/domains/sur-le-sentier.fr/backup_user-data_2108080143_2108150143.tgz
251M /var/lib/psa/dumps/domains/sur-le-sentier.fr/backup_user-data_2108080143_2108290143.tgz
251M /var/lib/psa/dumps/domains/sur-le-sentier.fr/backup_user-data_2108080143_2108220143.tgz
How to Clear Systemd Journal Logs¶
Voir les derniers logs:¶
$ journalctl -r
Hint: You are currently not seeing messages from other users and the system.
Users in groups 'adm', 'systemd-journal' can see all messages.
Pass -q to turn off this notice.
-- Logs begin at Tue 2023-08-01 13:45:12 CEST, end at Tue 2023-08-01 14:18:59 CEST. --
août 01 14:18:59 localhost sshd[66502]: Disconnected from user bruno 92.184.105.67 port 59557
août 01 14:18:59 localhost sshd[66502]: Received disconnect from 92.184.105.67 port 59557:11: cleanup
août 01 14:03:57 localhost sshd[66463]: Disconnected from user bruno 92.184.105.67 port 59553
Voir la place occupée par les logs:¶
$ journalctl --disk-usage -q
Archived and active journals take up 24.0M in the file system.
Faire tourner les journeaux de logs:¶
Le journal courant est archivé, un nouveau est crée
$ sudo journalctl --rotate
Supprimer les journaux vieux de plus de 2 jours:¶
# 2h(ours), 2m(onths), 2w(eeks)
$ sudo journalctl --vacuum-time=2d
Vacuuming done, freed 0B of archived journals from /var/log/journal.
Deleted archived journal /var/log/journal/5fd6a638ff89491ab71a5b5150cf1c13/user-10001@74abf00168a74a3884bd8c3fc35ea7c1-0000000002757ece-0005fb79b9881a67.journal (8.0M).
Deleted archived journal /var/log/journal/5fd6a638ff89491ab71a5b5150cf1c13/system@72ce45a2f8954e2c92ac122b6c16569e-00000000027580a5-0005fb79e618be9c.journal (96.0M).
Garder 100Mo de journaux:¶
$ sudo journalctl --vacuum-size=100M
Garder 5 fichiers de journaux:¶
$ sudo journalctl --vacuum-files=5
Nettoyer automatiquement les vieux journaux:¶
# Sauvegarder le fichier de config de journald
$ cp /etc/systemd/journald.conf /etc/systemd/journald.conf.back
# Editer le fichier de configuration de journald
$ sudo nano /etc/systemd/journald.conf
# Décommenter la ligne SystemMaxUse
SystemMaxUse=250M
# Redémarrer journald
$ sudo systemctl restart systemd-journald
Dernière mise à jour:
March 4, 2022