14-11-2023
This commit is contained in:
@@ -556,6 +556,12 @@ $ sudo service gitea restart
|
||||
|
||||
|
||||
|
||||
### Gitea Doctor
|
||||
|
||||
https://blog.gitea.io/2022/06/a-gentle-introduction-to-the-gitea-doctor/
|
||||
|
||||
|
||||
|
||||
### Liens
|
||||
|
||||
https://wiki.visionduweb.fr/index.php?title=Installer_un_serveur_Git_avec_Gitea#Copier_les_certificats_SSL_de_Let.27s_Encrypt_vers_le_r.C3.A9pertoire_keys_cr.C3.A9.C3.A9_pour_Gitea
|
||||
|
||||
@@ -110,6 +110,16 @@ service mysql restart || service mariadb restart || service mysqld restart
|
||||
|
||||
|
||||
|
||||
#### Redémarrer PHP:
|
||||
|
||||
```bash
|
||||
# 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:
|
||||
|
||||
```bash
|
||||
@@ -189,10 +199,10 @@ https://support.plesk.com/hc/en-us/articles/115002557954-How-to-remove-Plesk-bac
|
||||
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:
|
||||
@@ -234,3 +244,77 @@ find / -type f -size +200M -exec du -h {} + 2>/dev/null | sort -r -h
|
||||
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:
|
||||
|
||||
```bash
|
||||
$ 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:
|
||||
|
||||
```bash
|
||||
$ 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
|
||||
|
||||
```bash
|
||||
$ sudo journalctl --rotate
|
||||
```
|
||||
|
||||
##### Supprimer les journaux vieux de plus de 2 jours:
|
||||
|
||||
```bash
|
||||
# 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:
|
||||
|
||||
```bash
|
||||
$ sudo journalctl --vacuum-size=100M
|
||||
```
|
||||
|
||||
##### Garder 5 fichiers de journaux:
|
||||
|
||||
```bash
|
||||
$ sudo journalctl --vacuum-files=5
|
||||
```
|
||||
|
||||
##### Nettoyer automatiquement les vieux journaux:
|
||||
|
||||
```bash
|
||||
# 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
|
||||
```
|
||||
|
||||
|
||||
@@ -6,6 +6,157 @@ https://docs.nextcloud.com/server/18/admin_manual/index.html
|
||||
|
||||
|
||||
|
||||
### Paramètres PHP:
|
||||
|
||||
#### Directives supplémentaires:
|
||||
|
||||
```ini
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.interned_strings_buffer=8
|
||||
opcache.max_accelerated_files=10000
|
||||
opcache.memory_consumption=128
|
||||
opcache.save_comments=1
|
||||
opcache.revalidate_freq=1
|
||||
|
||||
[php-fpm-pool-settings]
|
||||
env[PATH] = /usr/local/bin:/usr/bin:/bin
|
||||
```
|
||||
|
||||
### Paramètres Apache et Nginx:
|
||||
|
||||
#### Directives supplémentaires Apache:
|
||||
|
||||
```ini
|
||||
<LocationMatch "(?i:(?:wp-config\\.bak|\\.wp-config\\.php\\.swp|(?:license|changelog|-config|-sample)\\.(?:php|md|txt|htm|html)))">
|
||||
Require all denied
|
||||
</LocationMatch>
|
||||
```
|
||||
|
||||
#### Directives supplémentaires Nginx:
|
||||
|
||||
```ini
|
||||
# wordpress
|
||||
location ~* "(?:wp-config\.bak|\.wp-config\.php\.swp|(?:license|changelog|-config|-sample)\.(?:php|md|txt|htm|html))" {
|
||||
return 403;
|
||||
}
|
||||
|
||||
# Add headers to serve security related headers
|
||||
# Before enabling Strict-Transport-Security headers please read into this
|
||||
# topic first.
|
||||
|
||||
# WARNING: Only add the preload option once you read about
|
||||
# the consequences in https://hstspreload.org/. This option
|
||||
# will add the domain to a hardcoded list that is shipped
|
||||
# in all major browsers and getting removed from this list
|
||||
# could take several months.
|
||||
|
||||
# HTTP response headers borrowed from Nextcloud `.htaccess`
|
||||
|
||||
location = /robots.txt {
|
||||
allow all;
|
||||
log_not_found off;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
# Make a regex exception for `/.well-known` so that clients can still
|
||||
# access it despite the existence of the regex rule
|
||||
# `location ~ /(\.|autotest|...)` which would otherwise handle requests
|
||||
# for `/.well-known`.
|
||||
|
||||
location ^~ /.well-known {
|
||||
# The rules in this block are an adaptation of the rules
|
||||
# in the Nextcloud `.htaccess` that concern `/.well-known`.
|
||||
|
||||
location = /.well-known/carddav { return 301 /nextcloud/remote.php/dav/; }
|
||||
location = /.well-known/caldav { return 301 /nextcloud/remote.php/dav/; }
|
||||
|
||||
location /.well-known/acme-challenge { try_files $uri $uri/ =404; }
|
||||
location /.well-known/pki-validation { try_files $uri $uri/ =404; }
|
||||
|
||||
# Let Nextcloud's API for `/.well-known` URIs handle all other
|
||||
# requests by passing them to the front-end controller.
|
||||
return 301 /nextcloud/index.php$request_uri;
|
||||
}
|
||||
|
||||
# Enable gzip but do not remove ETag headers
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_comp_level 4;
|
||||
gzip_min_length 256;
|
||||
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
|
||||
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
|
||||
|
||||
# Pagespeed is not supported by Nextcloud, so if your server is built
|
||||
# with the `ngx_pagespeed` module, uncomment this line to disable it.
|
||||
#pagespeed off;
|
||||
|
||||
# Remove X-Powered-By, which is an information leak
|
||||
|
||||
fastcgi_hide_header X-Powered-By;
|
||||
|
||||
location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ {
|
||||
deny all;
|
||||
}
|
||||
location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console) {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location ~ ^\/(?:updater|oc[ms]-provider)(?:$|\/) {
|
||||
try_files $uri/ =404;
|
||||
index index.php;
|
||||
}
|
||||
|
||||
# Adding the cache control header for js, css and map files
|
||||
# Make sure it is BELOW the PHP block
|
||||
# Add headers to serve security related headers (It is intended to
|
||||
# have those duplicated to the ones above)
|
||||
# Before enabling Strict-Transport-Security headers please read into
|
||||
# this topic first.
|
||||
|
||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
|
||||
|
||||
# WARNING: Only add the preload option once you read about
|
||||
# the consequences in https://hstspreload.org/. This option
|
||||
# will add the domain to a hardcoded list that is shipped
|
||||
# in all major browsers and getting removed from this list
|
||||
# could take several months.
|
||||
|
||||
location ~ \.(?:css|js|woff2?|svg|gif|map)$ {
|
||||
try_files $uri /index.php$request_uri;
|
||||
add_header Cache-Control "public, max-age=15778463";
|
||||
# Add headers to serve security related headers (It is intended
|
||||
# to have those duplicated to the ones above)
|
||||
# Before enabling Strict-Transport-Security headers please read
|
||||
# into this topic first.
|
||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
|
||||
#
|
||||
# WARNING: Only add the preload option once you read about
|
||||
# the consequences in https://hstspreload.org/. This option
|
||||
# will add the domain to a hardcoded list that is shipped
|
||||
# in all major browsers and getting removed from this list
|
||||
# could take several months.
|
||||
add_header Referrer-Policy no-referrer;
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
add_header X-Download-Options noopen;
|
||||
add_header X-Frame-Options SAMEORIGIN;
|
||||
add_header X-Permitted-Cross-Domain-Policies none;
|
||||
add_header X-Robots-Tag none;
|
||||
add_header X-XSS-Protection "1; mode=block" always;
|
||||
|
||||
# Optional: Don't log access to assets
|
||||
access_log off;
|
||||
}
|
||||
|
||||
location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap)$ {
|
||||
try_files $uri /index.php$request_uri;
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Réparation
|
||||
|
||||
Se mettre dans le répertoire de Nextcloud:
|
||||
|
||||
```bash
|
||||
@@ -15,7 +166,7 @@ Se mettre dans le répertoire de Nextcloud:
|
||||
Activer le mode maintenance:
|
||||
|
||||
```bash
|
||||
~/httpdocs/nextcloud$ sudo -u bruno /opt/plesk/php/7.3/bin/php occ maintenance:mode --on
|
||||
~/httpdocs/nextcloud$ sudo -u bruno /opt/plesk/php/8.0/bin/php occ maintenance:mode --on
|
||||
The current PHP memory limit is below the recommended value of 512MB.
|
||||
Maintenance mode enabled
|
||||
```
|
||||
@@ -23,11 +174,11 @@ Maintenance mode enabled
|
||||
Lance une réparation:
|
||||
|
||||
```bash
|
||||
~/httpdocs/nextcloud$ sudo -u bruno /opt/plesk/php/7.3/bin/php occ maintenance:repair
|
||||
~/httpdocs/nextcloud$ sudo -u bruno /opt/plesk/php/8.0/bin/php occ maintenance:repair
|
||||
```
|
||||
|
||||
```bash
|
||||
~/httpdocs/nextcloud$ sudo -u bruno /opt/plesk/php/7.3/bin/php updater/updater.phar
|
||||
~/httpdocs/nextcloud$ sudo -u bruno /opt/plesk/php/8.0/bin/php updater/updater.phar
|
||||
Nextcloud Updater - version: v16.0.3-3-ga0c2b25 dirty
|
||||
|
||||
Current version is 18.0.3.
|
||||
@@ -38,19 +189,19 @@ Nothing to do.
|
||||
```
|
||||
|
||||
```bash
|
||||
~/httpdocs/nextcloud$ sudo -u bruno /opt/plesk/php/7.3/bin/php occ upgrade
|
||||
~/httpdocs/nextcloud$ sudo -u bruno /opt/plesk/php/8.0/bin/php occ upgrade
|
||||
The current PHP memory limit is below the recommended value of 512MB.
|
||||
Nextcloud is already latest version
|
||||
```
|
||||
|
||||
```bash
|
||||
~/httpdocs/nextcloud$ sudo -u bruno /opt/plesk/php/7.3/bin/php occ maintenance:mode --off
|
||||
~/httpdocs/nextcloud$ sudo -u bruno /opt/plesk/php/8.0/bin/php occ maintenance:mode --off
|
||||
The current PHP memory limit is below the recommended value of 512MB.
|
||||
Maintenance mode disabled
|
||||
```
|
||||
|
||||
```bash
|
||||
~/httpdocs/nextcloud$ sudo -u bruno /opt/plesk/php/7.3/bin/php console.php files:scan --all
|
||||
~/httpdocs/nextcloud$ sudo -u bruno /opt/plesk/php/8.0/bin/php console.php files:scan --all
|
||||
The current PHP memory limit is below the recommended value of 512MB.
|
||||
Starting scan for user 1 out of 1 (bruno)
|
||||
+---------+-------+--------------+
|
||||
@@ -62,18 +213,34 @@ Starting scan for user 1 out of 1 (bruno)
|
||||
|
||||
|
||||
|
||||
#### Mise-à-jour de Nextcloud:
|
||||
### Mise-à-jour de Nextcloud:
|
||||
|
||||
```bash
|
||||
~$ ./upgrade_nextcloud.sh
|
||||
```
|
||||
|
||||
Si erreur pendant la m-à-j : PHP Fatal error: Allowed memory size of 134217728 bytes exhausted
|
||||
|
||||
```bash
|
||||
[✔] Downloading
|
||||
[ ] Verify integrity ...PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 189370744 bytes) in phar:///var/www/vhosts/maboiteverte.fr/httpdocs/nextcloud/updater/updater.phar/lib/Updater.php on line 652
|
||||
```
|
||||
|
||||
executer la commande avec `-d memory_limit=-1`en paramètre:
|
||||
|
||||
```bash
|
||||
[bruno@localhost nextcloud]$ sudo -u bruno /opt/plesk/php/8.0/bin/php -d memory_limit=-1 updater/updater.phar
|
||||
Nextcloud Updater - version: v25.0.3-2-gd49ee0d
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Erreurs:
|
||||
|
||||
#### La base de données a quelques index manquants:
|
||||
|
||||
```bash
|
||||
~/httpdocs/nextcloud$ sudo -u bruno /opt/plesk/php/7.4/bin/php occ db:add-missing-indices
|
||||
~/httpdocs/nextcloud$ sudo -u bruno /opt/plesk/php/8.0/bin/php occ db:add-missing-indices
|
||||
```
|
||||
|
||||
|
||||
@@ -112,7 +279,7 @@ https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/loggi
|
||||
Afficher les logs:
|
||||
|
||||
```lo
|
||||
tail -f /var/www/vhosts/maboiteverte.fr/httpdocs/nextcloud/nextcloud.log
|
||||
tail -f /var/www/vhosts/maboiteverte.fr/httpdocs/nextcloud/data/nextcloud.log
|
||||
```
|
||||
|
||||
Configuration:
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
|
||||
|
||||
Installer l'extension Gestionnaire Node.js:
|
||||
#### Installer l'extension Gestionnaire Node.js:
|
||||
|
||||
```bash
|
||||
# plesk ext nodejs --versions
|
||||
@@ -38,18 +38,80 @@ root@localhost:~# ln -s /opt/plesk/node/16/bin/node /usr/bin/node
|
||||
root@localhost:~# ln -s /opt/plesk/node/16/bin/npm /usr/bin/npm
|
||||
```
|
||||
|
||||
Installer thumsup:
|
||||
|
||||
|
||||
#### Installer thumsup (en root):
|
||||
|
||||
```bash
|
||||
[sentier@localhost ~]$ sudo -i
|
||||
|
||||
This server is powered by Plesk.
|
||||
|
||||
Run the 'plesk login' command and log in by browsing either of the links received in the output.
|
||||
Use the 'plesk' command to manage the server. Run 'plesk help' for more info.
|
||||
|
||||
root@localhost:~#
|
||||
```
|
||||
|
||||
```bash
|
||||
root@localhost:~# npm install -g thumbsup
|
||||
|
||||
/opt/plesk/node/16/lib/node_modules/thumbsup'
|
||||
/opt/plesk/node/17/lib/node_modules/thumbsup'
|
||||
|
||||
root@localhost:~# ln -s /opt/plesk/node/16/lib/node_modules/thumbsup/bin/thumbsup.js /usr/bin/thumbsup
|
||||
root@localhost:~# ln -s /opt/plesk/node/17/lib/node_modules/thumbsup/bin/thumbsup.js /usr/bin/thumbsup
|
||||
|
||||
```
|
||||
|
||||
Installer les dépendances:
|
||||
Bug macOS Ventura
|
||||
|
||||
```bash
|
||||
/Users/bruno/.nvm/versions/node/v18.12.0/lib/node_modules/thumbsup/node_modules/macos-release/index.js
|
||||
```
|
||||
|
||||
```js
|
||||
'use strict';
|
||||
const os = require('os');
|
||||
|
||||
const nameMap = new Map([
|
||||
[22, ['Ventura', '13']],
|
||||
[21, ['Monterey', '12']],
|
||||
[20, ['Big Sur', '11']],
|
||||
[19, ['Catalina', '10.15']],
|
||||
[18, ['Mojave', '10.14']],
|
||||
[17, ['High Sierra', '10.13']],
|
||||
[16, ['Sierra', '10.12']],
|
||||
[15, ['El Capitan', '10.11']],
|
||||
[14, ['Yosemite', '10.10']],
|
||||
[13, ['Mavericks', '10.9']],
|
||||
[12, ['Mountain Lion', '10.8']],
|
||||
[11, ['Lion', '10.7']],
|
||||
[10, ['Snow Leopard', '10.6']],
|
||||
[9, ['Leopard', '10.5']],
|
||||
[8, ['Tiger', '10.4']],
|
||||
[7, ['Panther', '10.3']],
|
||||
[6, ['Jaguar', '10.2']],
|
||||
[5, ['Puma', '10.1']]
|
||||
]);
|
||||
|
||||
const macosRelease = release => {
|
||||
release = Number((release || os.release()).split('.')[0]);
|
||||
|
||||
const [name, version] = nameMap.get(release);
|
||||
|
||||
return {
|
||||
name,
|
||||
version
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = macosRelease;
|
||||
// TODO: remove this in the next major version
|
||||
module.exports.default = macosRelease;
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Installer les dépendances:
|
||||
|
||||
```bash
|
||||
# apt install libimage-exiftool-perl
|
||||
|
||||
Reference in New Issue
Block a user