Màj 06-04-2024

This commit is contained in:
2024-04-06 09:54:09 +02:00
parent cd8cebe7cb
commit 259b9c6a24
76 changed files with 5126 additions and 229 deletions

View File

@@ -231,19 +231,22 @@ $ nano /opt/homebrew/etc/httpd/extra/httpd-vhosts.conf
</VirtualHost>
```
#### Redirection de port:
wiki.js tourne sur localhost:3000
Pour le rendre disponible sur wiki.silverbook.local:
Editer le fichier *httpd.conf* et activer les modules `mod_proxy` et `mod_proxy_http`:
##### Editer le fichier *httpd.conf* et activer les modules `mod_proxy` et `mod_proxy_http`:
```http
LoadModule proxy_module lib/httpd/modules/mod_proxy.so
LoadModule proxy_http_module lib/httpd/modules/mod_proxy_http.so
```
Editer le fichier *hosts*:
##### Editer le fichier *hosts*:
```bash
$ sudo nano /etc/hosts
@@ -251,7 +254,7 @@ $ sudo nano /etc/hosts
127.0.0.1 wiki.airbook.local
```
Editer le fichier *httpd-vhosts.conf*:
##### Editer le fichier *httpd-vhosts.conf*:
```http
<VirtualHost *:80>
@@ -260,14 +263,13 @@ Editer le fichier *httpd-vhosts.conf*:
ProxyPassReverse / http://localhost:3000/
ProxyPreserveHost On
</VirtualHost>
```
### SSL:
Activer SSL dans *httpd.conf* (décocher les lignes):
##### Activer SSL dans *httpd.conf* (décocher les lignes):
```http
LoadModule socache_shmcb_module lib/httpd/modules/mod_socache_shmcb.so
@@ -291,7 +293,11 @@ Include /usr/local/etc/httpd/extra/httpd-ssl.conf
Ouvrir le fichier *httpd-ssl.conf*:
##### Ouvrir le fichier *httpd-ssl.conf*:
```bash
$ bbedit /opt/homebrew/etc/httpd/extra/httpd-ssl.conf
```
```bash
# Mac intel
@@ -301,13 +307,12 @@ $ nano /usr/local/etc/httpd/extra/httpd-ssl.conf
$ nano /opt/homebrew/etc/httpd/extra/httpd-ssl.conf
```
Remplacer les lignes:
##### Remplacer les lignes:
| Original | Modifié |
| -------------------------------------- | ----------------------------------- |
| `Listen 8443` | `Listen 443` |
et le bloc:
```http
@@ -330,13 +335,13 @@ par
DocumentRoot "/Users/bruno/Sites"
ServerName airbook.local:443
ServerAdmin bruno@clicclac.info
ErrorLog "/opt/homebrew/var/log/httpd/error_log"
TransferLog "/opt/homebrew/var/log/httpd/access_log"
ErrorLog "/opt/homebrew/var/log/httpd/airbook.local-error_log"
TransferLog "/opt/homebrew/var/log/httpd/airbook.local-access_log"
```
Ouvrir le fichier *httpd-vhosts.conf*:
##### Ouvrir le fichier *httpd-vhosts.conf*:
Rajouter ce bloc pour chaque Virtual Host.
@@ -347,6 +352,8 @@ Rajouter ce bloc pour chaque Virtual Host.
SSLEngine on
SSLCertificateFile "/usr/local/etc/httpd/server.crt"
SSLCertificateKeyFile "/usr/local/etc/httpd/server.key"
ErrorLog "/opt/homebrew/var/log/httpd/airbook.local-error_log"
CustomLog "/opt/homebrew/var/log/httpd/airbook.local-access_log" common
</VirtualHost>
```
@@ -381,7 +388,7 @@ Installer 2 programmes:
$ brew install mkcert nss
```
Installer le serveur de certificat:
##### Installer le serveur de certificat:
```bash
$ mkcert -install
@@ -405,41 +412,48 @@ Enter Password or Pin for "NSS Certificate DB":
# https://github.com/FiloSottile/mkcert/issues/50
```
Créer les dossiers pour les certificats:
##### Créer les dossiers pour les certificats:
```bash
$ cd /opt/homebrew/etc/httpd
$ mkdir certs && cd certs
```
Générer les certificats:
##### Générer les certificats (wildcard):
```bash
$ mkcert airbook.local
$ mkcert airbook.local "*.airbook.local" localhost 127.0.0.1 ::1
$ mkcert airbook.local "*.airbook.local" 192.168.2.39 localhost 127.0.0.1 ::1
Created a new certificate valid for the following names 📜
- "airbook.local"
- "*.airbook.local"
- "localhost"
- "127.0.0.1"
- "::1"
The certificate is at "./airbook.local.pem" and the key at "./airbook.local-key.pem"
Reminder: X.509 wildcards only go one level deep, so this won't match a.b.airbook.local
It will expire on 18 February 2026 🗓
The certificate is at "./airbook.local+4.pem" and the key at "./airbook.local+4-key.pem"
It will expire on 18 April 2026 🗓
```
Un certificat et une clé sont créer pour chaque domaine:
```http
/opt/homebrew/etc/httpd/certs/airbook.local.pem
/opt/homebrew/etc/httpd/certs/airbook.local-key.pem
/opt/homebrew/etc/httpd/certs/airbook.local+4.pem
/opt/homebrew/etc/httpd/certs/airbook.local+4-key.pem
```
Editer le fichier *httpd-ssl.conf* et remplacer les 2 lignes:
##### Editer le fichier *httpd-ssl.conf* et remplacer les 2 lignes:
```http
SSLCertificateFile "/opt/homebrew/etc/httpd/certs/airbook.local.pem"
SSLCertificateKeyFile "/opt/homebrew/etc/httpd/certs/airbook.local-key.pem"
SSLCertificateFile "/opt/homebrew/etc/httpd/certs/airbook.local+4.pem"
SSLCertificateKeyFile "/opt/homebrew/etc/httpd/certs/airbook.local+4-key.pem"
```
Tester la configuration:
##### Tester la configuration:
```bash
$ httpd -t
@@ -448,7 +462,7 @@ Syntax OK
$ apachectl configtest
```
Redémarrer Apache:
##### Redémarrer Apache:
```bash
$ brew services restart httpd
@@ -460,15 +474,31 @@ $ brew services restart httpd
Editer le fichier *httpd-vhosts.conf*:
Rajouter le bloc suivant
Rajouter le/les bloc(s) suivant
```http
<VirtualHost *:443>
ServerAdmin bruno@clicclac.info
DocumentRoot "/Users/bruno/Sites"
ServerName airbook.local
SSLEngine on
SSLCertificateFile "/opt/homebrew/etc/httpd/certs/airbook.local.pem"
SSLCertificateKeyFile "/opt/homebrew/etc/httpd/certs/airbook.local-key.pem"
SSLCertificateFile "/opt/homebrew/etc/httpd/certs/airbook.local+4.pem"
SSLCertificateKeyFile "/opt/homebrew/etc/httpd/certs/airbook.local-key+4.pem"
ErrorLog "/opt/homebrew/var/log/httpd/airbook.local-error_log"
CustomLog "/opt/homebrew/var/log/httpd/airbook.local-access_log" common
</VirtualHost>
```
```http
<VirtualHost *:443>
ServerAdmin bruno@clicclac.info
DocumentRoot "/Users/bruno/Sites/mbv"
ServerName maboiteverte.airbook.local
SSLEngine on
SSLCertificateFile "/opt/homebrew/etc/httpd/certs/airbook.local+4.pem"
SSLCertificateKeyFile "/opt/homebrew/etc/httpd/certs/airbook.local+4-key.pem"
ErrorLog "/opt/homebrew/var/log/httpd/mbv.airbook.local-error_log"
CustomLog "/opt/homebrew/var/log/httpd/mbv.airbook.local-access_log" common
</VirtualHost>
```
@@ -501,9 +531,9 @@ Il faut rajouter les lignes suivantes au PHP.ini
```ini
[openssl]
openssl.cafile="/usr/local/etc/httpd/server.crt"
openssl.cafile="/opt/homebrew/etc/httpd/certs/airbook.local.pem"
# D'après SSLCertificateFile "/usr/local/etc/httpd/server.crt" du httpd-ssl.conf
# D'après SSLCertificateFile "/opt/homebrew/etc/httpd/certs/airbook.local.pem" du httpd-ssl.conf
```
@@ -522,17 +552,19 @@ ErrorDocument 404 /custom_404.html
ErrorDocument 500 /custom_50x.html
```
[:fa-link: https://httpd.apache.org/docs/2.4/fr/custom-error.html](https://httpd.apache.org/docs/2.4/fr/custom-error.html)
### Messages d'erreur personnalisés multilingues:
Ouvrir le fichier *httpd-ssl.conf* et dé-commenter les lignes suivantes:
Ouvrir le fichier *httpd.conf* et dé-commenter les lignes suivantes:
```http
LoadModule include_module lib/httpd/modules/mod_include.so
LoadModule negotiation_module lib/httpd/modules/mod_negotiation.so
Include /usr/local/etc/httpd/extra/httpd-multilang-errordoc.conf
Include /opt/homebrew/etc/httpd/extra/httpd-multilang-errordoc.conf
```
@@ -543,13 +575,13 @@ Include /usr/local/etc/httpd/extra/httpd-multilang-errordoc.conf
$ brew install homebrew/php/phpmyadmin
```
Le fichier de configuration se trouve là:`/usr/local/etc/phpmyadmin.config.inc.php`
Le fichier de configuration se trouve là:`/opt/homebrew/etc/phpmyadmin.config.inc.php`
Ajouter le bloc qui suit dans le **httpd.conf**
```http
Alias /phpmyadmin /usr/local/share/phpmyadmin
<Directory /usr/local/share/phpmyadmin/>
Alias /phpmyadmin /opt/homebrew/share/phpmyadmin
<Directory /opt/homebrew/share/phpmyadmin/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
<IfModule mod_authz_core.c>
@@ -564,9 +596,7 @@ Ajouter le bloc qui suit dans le **httpd.conf**
### Message derreur personnalisé:
[:fa-link: https://httpd.apache.org/docs/2.4/fr/custom-error.html](https://httpd.apache.org/docs/2.4/fr/custom-error.html)
@@ -746,6 +776,16 @@ ScriptAlias /cgi-bin/ "/opt/homebrew/var/www/cgi-bin/"
#### Désinstallation
```bash
$ brew uninstall httpd
$ rm -rf /opt/homebrew/etc/httpd
```
### Liens:
[:fa-link: https://getgrav.org/blog/macos-bigsur-apache-multiple-php-versions](https://getgrav.org/blog/macos-bigsur-apache-multiple-php-versions)

View File

@@ -130,3 +130,140 @@ $ sphp 7.4
#### Xdebug
##### Installation:
```bash
$ sphp 8.2
$ pecl uninstall -r xdebug
$ pecl install xdebug
```
```bash
$ sphp 8.3
$ pecl uninstall -r xdebug
$ pecl install xdebug-3.3.0alpha3
```
##### Configuration:
```bash
$ bbedit /opt/homebrew/etc/php/8.2/conf.d/ext-xdebug.ini
$ bbedit /opt/homebrew/etc/php/8.3/conf.d/ext-xdebug.ini
```
```http
[xdebug]
zend_extension="xdebug.so"
xdebug.mode=debug
```
#### Xdebug Switcher:
##### Installation:
```bash
$ curl -L https://gist.githubusercontent.com/rhukster/073a2c1270ccb2c6868e7aced92001cf/raw/c1629293bcf628cd6ded20c201c4ef0a2fa79144/xdebug > /opt/homebrew/bin/xdebug
$ chmod +x /opt/homebrew/bin/xdebug
```
```bash
$ xdebug
Usage: xdebug <on | off> [--no-server-restart]
You are running PHP v8.2 with Xdebug enabled
PHP 8.2.14 (cli) (built: Dec 20 2023 06:28:06) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.14, Copyright (c) Zend Technologies
with Zend OPcache v8.2.14, Copyright (c), by Zend Technologies
with Xdebug v3.3.1, Copyright (c) 2002-2023, by Derick Rethans
```
#### APCu
##### Installation:
```bash
$ pecl install apcu
# fatal error: 'pcre2.h' file not found
$ ln -s /opt/homebrew/Cellar/pcre2/10.42/include/pcre2.h /opt/homebrew/Cellar/php/
ln -s /opt/homebrew/Cellar/pcre2/10.42/include/pcre2.h /opt/homebrew/Cellar/php/8.3.1/include/php/ext/pcre/pcre2.h
ln -s /opt/homebrew/Cellar/pcre2/10.42/include/pcre2.h /opt/homebrew/Cellar/php@8.2/8.2.14/include/php/ext/pcre/pcre2.h
```
```bash
$ sphp 8.2
$ pecl install apcu
```
```bash
$ sphp 8.3
$ pecl uninstall -r apcu
$ pecl install apcu
```
##### Configuration:
```bash
$ bbedit /opt/homebrew/etc/php/8.2/conf.d/ext-apcu.ini
$ bbedit /opt/homebrew/etc/php/8.3/conf.d/ext-apcu.ini
```
```http
[apcu]
extension="apcu.so"
apc.enabled=1
apc.shm_size=64M
apc.ttl=7200
apc.enable_cli=1
```
#### YAML
Installation:
```bash
$ brew install libyaml
```
```bash
$ sphp 8.2
$ pecl install yaml
# Au prompt "Please provide the prefix of libyaml installation [autodetect]", entrer:
# /opt/homebrew/Cellar/libyaml/0.2.5
```
```bash
$ sphp 8.3
$ pecl uninstall -r yaml
$ pecl install yaml
# Au prompt "Please provide the prefix of libyaml installation [autodetect]", entrer:
# /opt/homebrew/Cellar/libyaml/0.2.5
```
##### Configuration:
```bash
$ bbedit /opt/homebrew/etc/php/8.2/conf.d/ext-yaml.ini
$ bbedit /opt/homebrew/etc/php/8.3/conf.d/ext-yaml.ini
```
```http
[yaml]
extension="yaml.so"
```

View File

@@ -19,7 +19,7 @@ $ brew services restart redis
### Le fichier de config:
```bash
/opt/homebrew/etc/redis.conf
$ nano /opt/homebrew/etc/redis.conf
```
### Tester redis:
@@ -51,7 +51,7 @@ $ redis-server
30766:M 25 Jul 2022 11:46:58.613 # WARNING: The TCP backlog setting of 511 cannot be enforced because kern.ipc.somaxconn is set to the lower value of 128.
30766:M 25 Jul 2022 11:46:58.613 # Server initialized
30766:M 25 Jul 2022 11:46:58.613 * Ready to accept connections
30766:M 25 Jul 2022 11:46:58.613 * Ready to accept connections tcp
```