Apache » Historique » Version 13
Patrice Nadeau, 2015-06-13 09:51
| 1 | 3 | Patrice Nadeau | h1. Apache |
|---|---|---|---|
| 2 | 1 | Patrice Nadeau | |
| 3 | Serveur de page Web |
||
| 4 | |||
| 5 | --- |
||
| 6 | |||
| 7 | {{toc}} |
||
| 8 | |||
| 9 | 3 | Patrice Nadeau | h2. Installation |
| 10 | 1 | Patrice Nadeau | |
| 11 | > Le module _apache2-mod_php5_ n’a pas nécessairement déjà été installé. |
||
| 12 | <pre><code class="bash"> |
||
| 13 | zypper install apache2 apache2-mod_php5 |
||
| 14 | 5 | Patrice Nadeau | systemctl enable apache2.service |
| 15 | 1 | Patrice Nadeau | # Démarrer Apache : |
| 16 | 5 | Patrice Nadeau | systemctl start apache2.service |
| 17 | 1 | Patrice Nadeau | </code></pre> |
| 18 | |||
| 19 | Ouvrir dans le pare-feu : |
||
| 20 | <pre><code class="bash"> |
||
| 21 | yast firewall services add service=service:apache2 zone=EXT |
||
| 22 | </code></pre> |
||
| 23 | |||
| 24 | L’emplacement des fichier du serveur est _/srv/www/htdocs_. |
||
| 25 | |||
| 26 | 3 | Patrice Nadeau | h2. Serveurs virtuels |
| 27 | 1 | Patrice Nadeau | |
| 28 | 8 | Patrice Nadeau | h3. Redirection vers un dossier différent. |
| 29 | 6 | Patrice Nadeau | |
| 30 | Ex. : |
||
| 31 | * _intranet.domain.tld_ vers le dossier _/srv/www/htdocs/intranet_ |
||
| 32 | * _wiki.domain.tld_ vers le dossier _/srv/www/htdocs/wiki_ |
||
| 33 | |||
| 34 | 1 | Patrice Nadeau | Si le fichier _/etc/apache2/vhosts.d/vhost.conf_ n'existe pas |
| 35 | <pre><code class="bash"> |
||
| 36 | cd /etc/apache2/vhosts.d/ |
||
| 37 | cp vhost.template vhost.conf |
||
| 38 | </code></pre> |
||
| 39 | |||
| 40 | Modifier les items suivants : |
||
| 41 | * *ServerAdmin* : L'adresse de courriel de l'administrateur |
||
| 42 | 4 | Patrice Nadeau | * *ServerName* : Le FQDN(Fully Qualified Domain Name) du serveur |
| 43 | 1 | Patrice Nadeau | * *DocumentRoot* : L'emplacement des fichiers du site web |
| 44 | 7 | Patrice Nadeau | |
| 45 | h3. Redirection vers un serveur différent |
||
| 46 | |||
| 47 | 9 | Patrice Nadeau | Les modules _proxy_ et _proxy_http_ doivent être installés et actifs |
| 48 | |||
| 49 | Vérification de la liste des modules Apache |
||
| 50 | <pre><code class="bash"> |
||
| 51 | a2enmod -l |
||
| 52 | </code></pre> |
||
| 53 | |||
| 54 | 11 | Patrice Nadeau | Activation des modules s'il ne sont pas deja actifs |
| 55 | <pre><code class="bash"> |
||
| 56 | a2enmod proxy proxy_http |
||
| 57 | </code></pre> |
||
| 58 | |||
| 59 | 12 | Patrice Nadeau | Modifier le fichier _/etc/apache2/vhosts.d/vhost.conf_ |
| 60 | 13 | Patrice Nadeau | Ex. : On veux rediriger le service _service_ vers le serveur _server1_ |
| 61 | 12 | Patrice Nadeau | <pre><code class="c"> |
| 62 | <VirtualHost *:80> |
||
| 63 | ServerName service.domaine.com |
||
| 64 | ProxyPass / http://serveur1.domaine.com/ |
||
| 65 | ProxyPassReverse / http://serveur1.domaine.com/ |
||
| 66 | 13 | Patrice Nadeau | ServerAdmin admin@domaine.com |
| 67 | 12 | Patrice Nadeau | </VirtualHost> |
| 68 | 11 | Patrice Nadeau | |
| 69 | 12 | Patrice Nadeau | </code></pre> |
| 70 | 11 | Patrice Nadeau | |
| 71 | 7 | Patrice Nadeau | h3. Activation des changements |
| 72 | 1 | Patrice Nadeau | |
| 73 | Relire la configuration d'Apache |
||
| 74 | <pre><code class="bash"> |
||
| 75 | syctemsctl reload apache2 |
||
| 76 | </code></pre> |
||
| 77 | |||
| 78 | Commandes |
||
| 79 | 10 | Patrice Nadeau | * _apache2ctl -S_ : liste les serveurs virtuels |