From 91a081fda3b0e093dafe3733102c918351e23f76 Mon Sep 17 00:00:00 2001 From: Thomas Constans Date: Fri, 8 Jul 2022 12:14:48 +0200 Subject: [PATCH] solution --- Readme.md | 22 +++++----------------- site1.conf | 25 +++++++++++++++++++++++++ vh-site1.conf | 15 +++++++++++++++ 3 files changed, 45 insertions(+), 17 deletions(-) create mode 100644 site1.conf create mode 100644 vh-site1.conf diff --git a/Readme.md b/Readme.md index fc2d6b5..1e2e4e4 100644 --- a/Readme.md +++ b/Readme.md @@ -13,28 +13,16 @@ Cette instance va: ## Mise en oeuvre -Copier le fichier /usr/share/doc/httpd/instance.conf comme /etc/httpd.conf/*site1*.conf +cf site1.conf, à copier dans /etc/httpd/conf/site1.conf -Adapter ce fichier pour répondre aux objectifs ci-dessus - -Il est possible de vérifier la syntaxe du fichier via la commande -```bash -export HTTPD_INSTANCE=site1 ; httpd -tf /etc/httpd/conf/site1.conf -``` ## Gestion du service -on utilise l'unité httpd@**site1**.service avec systemctl -Pour que instance1 soit relancé avec l'instance principale: - -créer le répertoire + fichier /etc/systemd/system/httpd\@instance1.service.d/override.conf - -Y ajouter: -```ini -[Unit] - ReloadPropagatedFrom=httpd.service +```bash +systemctl enble httpd@site1.service +systemctl start httpd@site1.service ``` ## Configuration du serveur frontal -Il suffit de définir un VirtualHost qui va rediriger toutes les requètes reçues sur l'instance concernée, en utilisantl les directives _proxypass_ et _proxypassreverse_ +cf fichier vh-site1.conf à déployer dans /etc/httpd/conf.d/ diff --git a/site1.conf b/site1.conf new file mode 100644 index 0000000..bef3f33 --- /dev/null +++ b/site1.conf @@ -0,0 +1,25 @@ +#/etc/httpd/conf/site1.conf +DefaultRuntimeDir /run/httpd/instance-${HTTPD_INSTANCE} +PidFile /run/httpd/instance-${HTTPD_INSTANCE}.pid +Listen 8801 +Include conf.modules.d/*.conf +User user1 +Group user1 +ServerAdmin root@site1.lia.fr + + Options none + AllowOverride none + Require all denied + + +DocumentRoot "/srv/site1/www/" + + Require all granted + Options +indexes + +DirectoryIndex index.html index.php + + require all denied + +TypesConfig /etc/mime.types +EnableSendfile on diff --git a/vh-site1.conf b/vh-site1.conf new file mode 100644 index 0000000..f093120 --- /dev/null +++ b/vh-site1.conf @@ -0,0 +1,15 @@ +#/etc/httpd/conf.d/vh-site1.conf + + ServerName site1.lia.fr + ServerAlias www.site1.lia.fr + ServerAdmin root@site1.lia.fr + + ErrorLog /srv/site1/logs/error_log + CustomLog /srv/site1/logs/access_log combined + SSLEngine on + SSLCertificateFile /etc/ssl/certs/webserver.crt + SSLCertificateKeyFile /etc/ssl/private/webserver.key + + ProxyPass / http://127.0.0.1:8801 + ProxyPassReverse / http://127.0.0.1:8801 + \ No newline at end of file