123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337 |
- <!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">
-
-
-
- <link rel="shortcut icon" href="../img/favicon.ico">
- <title>Installation d'un serveur web - Les Tutoriels du Yojik</title>
- <link rel="stylesheet" href="../css/theme.css" />
- <link rel="stylesheet" href="../css/theme_extra.css" />
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css" />
-
- <script>
- // Current page data
- var mkdocs_page_name = "Installation d'un serveur web";
- var mkdocs_page_input_path = "Installation-Serveur-Web.md";
- var mkdocs_page_url = null;
- </script>
-
- <script src="../js/jquery-2.1.1.min.js" defer></script>
- <script src="../js/modernizr-2.8.3.min.js" defer></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
- <script>hljs.initHighlightingOnLoad();</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-scroll">
- <div class="wy-side-nav-search">
- <a href=".." class="icon icon-home"> Les Tutoriels du Yojik</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" title="Type search term here" />
- </form>
- </div>
- </div>
- <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
- <p class="caption"><span class="caption-text">Installation d'un serveur sécurisé, version Debian/Stretch (obsolète)</span></p>
- <ul>
- <li class="toctree-l1"><a class="reference internal" href="..">Présentation</a>
- </li>
- </ul>
- <p class="caption"><span class="caption-text">Installation</span></p>
- <ul class="current">
- <li class="toctree-l1"><a class="reference internal" href="../Installation-de-base/">Installation du système de base</a>
- </li>
- <li class="toctree-l1"><a class="reference internal" href="../ovh/">Démarrage sur serveur OVH</a>
- </li>
- <li class="toctree-l1"><a class="reference internal" href="../Premi%C3%A8re-Etape-S%C3%A9curisation/">Première étapes de sécurisation du serveur</a>
- </li>
- <li class="toctree-l1"><a class="reference internal" href="../Configuration-R%C3%A9seau/">Configuration du réseau</a>
- </li>
- <li class="toctree-l1"><a class="reference internal" href="../Installation-Serveur-Temps/">Installation d'un serveur de temps</a>
- </li>
- <li class="toctree-l1"><a class="reference internal" href="../Installation-Parre-Feu/">Installation d'un pare-feu</a>
- </li>
- <li class="toctree-l1"><a class="reference internal" href="../Installation-Fail2ban/">Contrer les attaques de brute-force avec fail2ban</a>
- </li>
- <li class="toctree-l1"><a class="reference internal" href="../Installation-Serveur-Courrier-Basique/">Installation d'un serveur de courrier basique</a>
- </li>
- <li class="toctree-l1"><a class="reference internal" href="../Installation-Serveur-DNS/">Installation du serveur DNS</a>
- </li>
- <li class="toctree-l1 current"><a class="reference internal current" href="./">Installation d'un serveur web</a>
- <ul class="current">
- <li class="toctree-l2"><a class="reference internal" href="#sauvegarde-de-notre-nouvelle-configuration">Sauvegarde de notre nouvelle configuration</a>
- </li>
- <li class="toctree-l2"><a class="reference internal" href="#creation-des-hotes-virtuels-virtual-hosts">Création des hôtes virtuels (virtual hosts)</a>
- </li>
- <li class="toctree-l2"><a class="reference internal" href="#creation-des-fichiers-html">Création des fichiers html</a>
- </li>
- </ul>
- </li>
- <li class="toctree-l1"><a class="reference internal" href="../Installation-Dovecot-Authentification/">Installation de dovecot et de l'authentification</a>
- </li>
- <li class="toctree-l1"><a class="reference internal" href="../Installation-Certificats-Letsencrypt/">Installation des certificats letsencrypt</a>
- </li>
- <li class="toctree-l1"><a class="reference internal" href="../Courrier-SPF-DKIM-OPENDMARC/">Ajout des enregistrements **spf**, **DKIM**, **DMARC** au fichier de zone DNS</a>
- </li>
- <li class="toctree-l1"><a class="reference internal" href="../Courrier-Comptes-Virtuels/">Ajout des comptes émail virtuels</a>
- </li>
- <li class="toctree-l1"><a class="reference internal" href="../Surveillance-Serveur/">Installation de programmes de surveillance du serveur</a>
- </li>
- <li class="toctree-l1"><a class="reference internal" href="../Installation-Webmail/">Installation d'un webmail (rainloop)</a>
- </li>
- <li class="toctree-l1"><a class="reference internal" href="../S%C3%A9curisation-Serveur-Web/">Sécurisation d'un serveur WEB</a>
- </li>
- </ul>
- </div>
- </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="..">Les Tutoriels du Yojik</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 »</li>
-
-
-
- <li>Installation d'un serveur web</li>
- <li class="wy-breadcrumbs-aside">
-
- </li>
- </ul>
-
- <hr/>
- </div>
- <div role="main">
- <div class="section">
-
- <h1 id="installation-dun-serveur-web">Installation d'un serveur web</h1>
- <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
- etc ...
- </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>
- <h2 id="sauvegarde-de-notre-nouvelle-configuration">Sauvegarde de notre nouvelle configuration</h2>
- <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>
- <h2 id="creation-des-hotes-virtuels-virtual-hosts">Création des hôtes virtuels (virtual hosts)</h2>
- <p>3 hôtes virtuels à créer:</p>
- <ul>
- <li>yojik.net</li>
- <li>www.yojik.net</li>
- <li>yazik.yojik.net</li>
- </ul>
- <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>
- <pre><code>a2ensite le_nom_du_fichier (a2ensite site1 site2 (pour moi))
- </code></pre>
- <p>On recharge apache2 pour la prise en compte de nos 2 sites.</p>
- <pre><code>service apache2 reload
- </code></pre>
- <h2 id="creation-des-fichiers-html">Création des fichiers html</h2>
- <p>Créez 2 répertoires sous /var/www/html:</p>
- <pre><code>mkdir /var/www/html/yojiknet /var/www/html/yaziknet
- cd /var/www/html
- </code></pre>
- <p>On crée un fichier <strong>index.html</strong> sous chaque répertoire créé:</p>
- <p>Exemple de fichier de base:</p>
- <p><code>/var/www/html/yojiknet/index.html</code></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>
- </code></pre>
- <p></html></p>
- <p><code>/var/www/html/yaziknet/index.html</code></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>
- <pre><code>chown -Rv www-data.www-data *
- </code></pre>
- <p>On relance apache</p>
- <pre><code>service apache2 restart
- </code></pre>
- <p>On teste avec un navigateur.</p>
- <ul>
- <li>
- <p>adresse 1: www.yojik.net</p>
- </li>
- <li>
- <p>adresse 2: yazik.yojik.net</p>
- </li>
- </ul>
- <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>
- <pre><code>yazik IN CNAME atom.yojik.net.
- </code></pre>
- <p>Re-testez: tout marche :)</p>
-
- </div>
- </div>
- <footer>
-
- <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
-
- <a href="../Installation-Dovecot-Authentification/" 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="../Installation-Serveur-DNS/" 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="https://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" aria-label="versions">
- <span class="rst-current-version" data-toggle="rst-current-version">
-
-
- <span><a href="../Installation-Serveur-DNS/" style="color: #fcfcfc;">« Previous</a></span>
-
-
- <span style="margin-left: 15px"><a href="../Installation-Dovecot-Authentification/" style="color: #fcfcfc">Next »</a></span>
-
- </span>
- </div>
- <script>var base_url = '..';</script>
- <script src="../js/theme.js" defer></script>
- <script src="../search/main.js" defer></script>
- <script defer>
- window.onload = function () {
- SphinxRtdTheme.Navigation.enable(true);
- };
- </script>
- </body>
- </html>
|