123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420 |
- <!DOCTYPE html>
- <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
- <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
-
-
-
- <title>Installation d'un serveur web - The Yojik Server Installation Guide</title>
-
- <link rel="shortcut icon" href="../img/favicon.ico">
-
- <link href='https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
- <link rel="stylesheet" href="../css/theme.css" type="text/css" />
- <link rel="stylesheet" href="../css/theme_extra.css" type="text/css" />
- <link rel="stylesheet" href="../css/highlight.css">
-
- <script>
- // Current page data
- var mkdocs_page_name = "Installation d'un serveur web";
- var mkdocs_page_input_path = "9-neuf.md";
- var mkdocs_page_url = "/9-neuf/";
- </script>
-
- <script src="../js/jquery-2.1.1.min.js"></script>
- <script src="../js/modernizr-2.8.3.min.js"></script>
- <script type="text/javascript" src="../js/highlight.pack.js"></script>
- <script src="../js/theme.js"></script>
-
- </head>
- <body class="wy-body-for-nav" role="document">
- <div class="wy-grid-for-nav">
-
- <nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
- <div class="wy-side-nav-search">
- <a href=".." class="icon icon-home"> The Yojik Server Installation Guide</a>
- <div role="search">
- <form id ="rtd-search-form" class="wy-form" action="../search.html" method="get">
- <input type="text" name="q" placeholder="Search docs" />
- </form>
- </div>
- </div>
- <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
- <ul class="current">
-
- <li>
- <li class="toctree-l1 ">
- <a class="" href="..">Home</a>
-
- </li>
- <li>
-
- <li>
- <li class="toctree-l1 ">
- <a class="" href="../1-un/">Installation d'un serveur Debian/Stretch sécurisé</a>
-
- </li>
- <li>
-
- <li>
- <li class="toctree-l1 ">
- <a class="" href="../2-deux/">Premières étapes de sécurisation du serveur</a>
-
- </li>
- <li>
-
- <li>
- <li class="toctree-l1 ">
- <a class="" href="../3-trois/">Configuration du réseau</a>
-
- </li>
- <li>
-
- <li>
- <li class="toctree-l1 ">
- <a class="" href="../4-quatre/">Installation d'un serveur de temps</a>
-
- </li>
- <li>
-
- <li>
- <li class="toctree-l1 ">
- <a class="" href="../5-cinq/">Installation d'un pare-feu</a>
-
- </li>
- <li>
-
- <li>
- <li class="toctree-l1 ">
- <a class="" href="../6-six/">Contrer les attaques de brute-force avec fail2ban</a>
-
- </li>
- <li>
-
- <li>
- <li class="toctree-l1 ">
- <a class="" href="../7-sept/">Installation d'un serveur de courrier basique</a>
-
- </li>
- <li>
-
- <li>
- <li class="toctree-l1 ">
- <a class="" href="../8-huit/">Installation du serveur DNS</a>
-
- </li>
- <li>
-
- <li>
- <li class="toctree-l1 current">
- <a class="current" href="./">Installation d'un serveur web</a>
-
- <ul>
-
- <li class="toctree-l3"><a href="#sauvegarde-de-notre-nouvelle-configuration">Sauvegarde de notre nouvelle configuration</a></li>
-
-
- <li class="toctree-l3"><a href="#creation-des-hotes-virtuels-virtual-hosts">Création des hôtes virtuels (virtual hosts)</a></li>
-
-
- <li class="toctree-l3"><a href="#creation-des-fichiers-html">Création des fichiers html</a></li>
-
-
- </ul>
-
- </li>
- <li>
-
- <li>
- <li class="toctree-l1 ">
- <a class="" href="../10-dix/">Installation de dovecot et de l'authentification</a>
-
- </li>
- <li>
-
- <li>
- <li class="toctree-l1 ">
- <a class="" href="../11-onze/">Installation des certificats letsencrypt</a>
-
- </li>
- <li>
-
- <li>
- <li class="toctree-l1 ">
- <a class="" href="../12-douze/">Ajout des enregistrements SPF et DKIM au fichier de zone DNS</a>
-
- </li>
- <li>
-
- <li>
- <li class="toctree-l1 ">
- <a class="" href="../17-dixsept/">Installation de programmes de surveillance du serveur</a>
-
- </li>
- <li>
-
- <li>
- <li class="toctree-l1 ">
- <a class="" href="../18-dixhuit/">Installation d'un webmail</a>
-
- </li>
- <li>
-
- <li>
- <li class="toctree-l1 ">
- <a class="" href="../19-dixneuf/">Installation de git et de gogs</a>
-
- </li>
- <li>
-
- </ul>
- </div>
-
- </nav>
- <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
-
- <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
- <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
- <a href="..">The Yojik Server Installation Guide</a>
- </nav>
-
- <div class="wy-nav-content">
- <div class="rst-content">
- <div role="navigation" aria-label="breadcrumbs navigation">
- <ul class="wy-breadcrumbs">
- <li><a href="..">Docs</a> »</li>
-
-
-
- <li>Installation d'un serveur web</li>
- <li class="wy-breadcrumbs-aside">
-
- </li>
- </ul>
- <hr/>
- </div>
- <div role="main">
- <div class="section">
-
- <p>## Installation d'un serveur web</p>
- <p>Nous allons installer un serveur Web: <strong>Apache</strong>. C'est juste celui que je connais le mieux. <strong>Nginx</strong> est une possible alternative très prisée et guère plus compliquée à mettre en oeuvre.</p>
- <pre><code>root@aijan:/etc/bind# apt install apache2
- Lecture des listes de paquets... Fait
- Construction de l'arbre des dépendances
- Lecture des informations d'état... Fait
- The following additional packages will be installed:
- apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0
- ...
- </code></pre>
- <p>Test de notre serveur:</p>
- <p>C'est bon, voilà une image de la page d'acceuil :</p>
- <p><img alt="Le serveur apache" src="../Images/apache.png" /></p>
- <p>Ne pas oublier d'ouvrir les ports du firewall: port 80 et 443 en TCP et UDP.</p>
- <p>Lignes à rajouter à firewall.sh:</p>
- <pre><code> # HTTP + HTTPS Out
- $IPT -t filter -A OUTPUT -p tcp --dport 80 -j ACCEPT
- $IPT -t filter -A OUTPUT -p tcp --dport 443 -j ACCEPT
- $IP6T -t filter -A OUTPUT -p tcp --dport 80 -j ACCEPT
- $IP6T -t filter -A OUTPUT -p tcp --dport 443 -j ACCEPT
- # HTTP + HTTPS In
- $IPT -t filter -A INPUT -p tcp --dport 80 -j ACCEPT
- $IPT -t filter -A INPUT -p tcp --dport 443 -j ACCEPT
- $IP6T -t filter -A INPUT -p tcp --dport 80 -j ACCEPT
- $IP6T -t filter -A INPUT -p tcp --dport 443 -j ACCEPT
- </code></pre>
- <h3 id="sauvegarde-de-notre-nouvelle-configuration">Sauvegarde de notre nouvelle configuration</h3>
- <pre><code>root@aijan:#cd /home/ericadmin/bin/
- root@aijan:/home/ericadmin/bin#./firewall.sh restart
- root@aijan:/home/ericadmin/bin#service netfilter-persistent save
- </code></pre>
- <h3 id="creation-des-hotes-virtuels-virtual-hosts">Création des hôtes virtuels (virtual hosts)</h3>
- <p>3 hôtes virtuels à créer:</p>
- <blockquote>
- <p>yojik.net
- www.yojik.net
- yazik.yojik.net</p>
- </blockquote>
- <p>Créez 2 fichiers d'hôtes virtuels. Exemple de fichier:</p>
- <p><strong>Virtualhost: www.yojik.net</strong></p>
- <pre><code><VirtualHost *:80>
- ServerAdmin webmaster@yojik.net
- ServerName www.yojik.net
- DocumentRoot /var/www/html/yojiknet/
- <Directory "/var/www/html/yojiknet/index.html">
- Options Indexes MultiViews
- AllowOverride FileInfo AuthConfig Indexes
- Order allow,deny
- allow from all
- Require all granted
- </Directory>
- ErrorLog ${APACHE_LOG_DIR}/error.log
- CustomLog ${APACHE_LOG_DIR}/access.log combined
- LogLevel warn
- </VirtualHost>
- </code></pre>
- <p><strong>Virtualhost: yazik.yojik.net</strong></p>
- <pre><code><VirtualHost *:80>
- ServerAdmin webmaster@yojik.net
- ServerName yazik.yojik.net
- DocumentRoot /var/www/html/yaziknet/
- <Directory "/var/www/html/yaziknet/index.html">
- Options Indexes MultiViews
- AllowOverride FileInfo AuthConfig Indexes
- Order allow,deny
- allow from all
- Require all granted
- </Directory>
- ErrorLog ${APACHE_LOG_DIR}/error.log
- CustomLog ${APACHE_LOG_DIR}/access.log combined
- LogLevel warn
- </VirtualHost>
- </code></pre>
- <p>Validez-les avec:</p>
- <blockquote>
- <p>a2ensite le_nom_du_fichier (a2ensite site1 site2 (pour moi))</p>
- </blockquote>
- <p>On recharge apache2 pour la prise en compte de nos 2 sites.</p>
- <blockquote>
- <p>service apache2 reload</p>
- </blockquote>
- <h3 id="creation-des-fichiers-html">Création des fichiers html</h3>
- <p>Créez 2 répertoires sous /var/www/html:</p>
- <blockquote>
- <p>mkdir /var/www/html/yojiknet /var/www/html/yaziknet</p>
- <p>cd /var/www/html</p>
- </blockquote>
- <p>On crée 2 fichiers <strong>index.html</strong> sous chaque répertoire créé:</p>
- <p>Exemple de fichier de base:</p>
- <p><strong>/var/www/html/yojiknet/index.html</strong></p>
- <pre><code><!DOCTYPE html>
- <html>
- <head>
- <title>The Yojik.net home page</title>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- </head>
- <body>
- <h1>The Yojik Net home page</h1>
- <p>Nothing interesting at the moment .. comming soon!</p>
- </body>
- </html>
- </code></pre>
- <p><strong>/var/www/html/yaziknet/index.html</strong></p>
- <pre><code><!DOCTYPE html>
- <html>
- <head>
- <title>The Yazik.net home page</title>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- </head>
- <body>
- <h1>The Yazik Net home page</h1>
- <p>Nothing interesting at the moment .. comming soon!</p>
- </body>
- </html>
- </code></pre>
- <p>Dans le répertoire <strong>/var/www/html/</strong> on lance la commande suivante pour ajuster les droits et propriétaires des fichiers (pour apache et Debian, c'est <strong>www-data</strong>.)</p>
- <blockquote>
- <p>chown -Rv www-data.www-data *</p>
- </blockquote>
- <p>On relance apache</p>
- <blockquote>
- <p>service apache2 restart</p>
- </blockquote>
- <p>On crée un </p>
- <p>On teste avec un navigateur.</p>
- <p>adresse 1: www.yojik.net</p>
- <p>adresse 2: yazik.yojik.net</p>
- <p>Vous vous apercevrez que la deuxième ne fonctionne pas: il vous faut ajouter le domaine yazik.yojik.net à votre fichier de zone de bind et relancer bind ensuite:</p>
- <blockquote>
- <p>yazik IN CNAME atom.yojik.net.</p>
- </blockquote>
- <p>Re-testez: tout marche :)</p>
-
- </div>
- </div>
- <footer>
-
- <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
-
- <a href="../10-dix/" class="btn btn-neutral float-right" title="Installation de dovecot et de l'authentification">Next <span class="icon icon-circle-arrow-right"></span></a>
-
-
- <a href="../8-huit/" class="btn btn-neutral" title="Installation du serveur DNS"><span class="icon icon-circle-arrow-left"></span> Previous</a>
-
- </div>
-
- <hr/>
- <div role="contentinfo">
- <!-- Copyright etc -->
-
- </div>
- Built with <a href="http://www.mkdocs.org">MkDocs</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
- </footer>
-
- </div>
- </div>
- </section>
- </div>
- <div class="rst-versions" role="note" style="cursor: pointer">
- <span class="rst-current-version" data-toggle="rst-current-version">
-
-
- <span><a href="../8-huit/" style="color: #fcfcfc;">« Previous</a></span>
-
-
- <span style="margin-left: 15px"><a href="../10-dix/" style="color: #fcfcfc">Next »</a></span>
-
- </span>
- </div>
- </body>
- </html>
|