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)