Outils pour utilisateurs

Outils du site


issue102:tutoriel_2

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
issue102:tutoriel_2 [2015/11/01 18:55] – créée auntieeissue102:tutoriel_2 [2015/11/16 18:49] (Version actuelle) andre_domenech
Ligne 1: Ligne 1:
-Now that our Linux VM is built and secure, it's time to install the web server.+**Now that our Linux VM is built and secure, it's time to install the web server.
  
 What exactly is a web server? What exactly is a web server?
Ligne 5: Ligne 5:
 A web server is software which serves web pages (and potentially other files – for example binaries – like videos, packages, … etc). A web server is software which serves web pages (and potentially other files – for example binaries – like videos, packages, … etc).
  
-And how does this really actually work? The web server runs as a daemon. “Daemon” - at least in the *nix family – means software that runs in background (meaning there is typically no output on the screen, the program runs silently without interaction from the user), and typically listens on a TCP port (more on TCP ports in part 2, published last week).+And how does this really actually work? The web server runs as a daemon. “Daemon” - at least in the *nix family – means software that runs in background (meaning there is typically no output on the screen, the program runs silently without interaction from the user), and typically listens on a TCP port (more on TCP ports in part 2, published last week).**
  
-When a request is sent to that specific listening port, the daemon wakes up and produces an action – for a web server, the daemon typically sends back a web page.+Maintenant que notre machine virtuelle Linux est construite et sûre, il est temps d'installer le serveur Web. 
 + 
 +Qu'est-ce exactement qu'un serveur Web ? 
 + 
 +Un serveur Web est un logiciel qui délivre des pages Web (et potentiellement d'autres fichiers – par exemple des binaires – comme des vidéos, des paquets, etc.) 
 + 
 +Et comment cela fonctionne-t-il réellement ? Le serveur Web fonctionne comme un démon. « Démon » signifie - au moins dans la famille *nix – un logiciel qui tourne en arrière-plan (ce qui signifie qu'il tourne silencieusement, sans sortie écran ni interaction avec l'utilisateur) et surveille un port TCP spécifique (pour plus de détails sur les ports TCP, voir la deuxième partie de cette série, sortie le mois dernier). 
 + 
 +**When a request is sent to that specific listening port, the daemon wakes up and produces an action – for a web server, the daemon typically sends back a web page.
  
 Which web server to choose? Which web server to choose?
Ligne 15: Ligne 23:
 Apache has been around for longer and has the largest market share. Ngix is supposed to be lighter and therefore maybe faster. Apache has been around for longer and has the largest market share. Ngix is supposed to be lighter and therefore maybe faster.
  
-I chose Apache for this tutorial – there is no specific reason why not ngix, which is also an excellent server, other than I personally have more exposure with Apache software in general.+I chose Apache for this tutorial – there is no specific reason why not ngix, which is also an excellent server, other than I personally have more exposure with Apache software in general.**
  
-Install Apache Web Server+Quand une requête est envoyée sur ce port particulier, le démon se déclenche et effectue une action – essentiellement, sur un serveur Web, le démon renvoie une page Web. 
 + 
 +Quel serveur Web choisir ? 
 + 
 +Les serveurs les plus populaires sont Apache, ngix, Microsoft et Google (liste recueillie chez netcraft.com). Je ne suis pas très habitué à Google en matière de serveur et Microsoft est à priori hors liste (imaginez pourquoi !). Il nous reste donc à choisir entre Apache et ngix. 
 + 
 +Apache existe depuis plus longtemps et possède la plus grande part du marché. Ngix est, semble-t-il, plus léger et pourrait donc être plus rapide. 
 + 
 +J'ai choisi Apache pour ce tutoriel – je n'ai aucune raison particulière de n'avoir pas choisi ngix, qui est un excellent serveur, autre que d'avoir une plus grande habitude des logiciels d'Apache en général. 
 + 
 + 
 +**Install Apache Web Server
  
 Before we start, note that I will also add the commands for Centos7. Before we start, note that I will also add the commands for Centos7.
Ligne 27: Ligne 46:
 Make sure to answer Y to continue (or hit enter) Make sure to answer Y to continue (or hit enter)
  
-We can now check that the web-server started properly (shown below) - using a web browser, key the IP address of the server (in my example it is 159.203.90.111).+We can now check that the web-server started properly (shown below) - using a web browser, key the IP address of the server (in my example it is 159.203.90.111).** 
 + 
 +Installer le serveur Web d'Apache 
 + 
 +Avant de commencer, notez que je vais également ajouter les commandes pour Centos7. 
 + 
 +Installer un serveur Web est aussi facile que d'exécuter cette commande ! 
 + 
 +sudo apt-get install apache2 (Centos7 – yum install httpd)  
 + 
 +Assurez-vous de répondre Y pour continuer (ou d'appuyer sur Entrée). 
 + 
 +On peut maintenant s'assurer que le serveur Web a démarré correctement (voir ci-dessous). En utilisant un navigateur Internet, entrez l'adresse IP du serveur (dans mon exemple c'est 159.203.90.111).
  
-Configuration and tuning+**Configuration and tuning
  
 Now that Apache is installed, we must tune, configure and secure the web server. Now that Apache is installed, we must tune, configure and secure the web server.
Ligne 55: Ligne 86:
  
 What does this all mean? What does this all mean?
 +
 • StartServers defines the minimum number of child server processes created when web server starts. 2 works well for me, not sure what the default is. • StartServers defines the minimum number of child server processes created when web server starts. 2 works well for me, not sure what the default is.
 +
 +
 • MinSpareServers is the minimum number of threads waiting for requests while MaxSpareServers is the maximum number. Higher the number, more load the server can handle, however we have to balance the values with our server resources (1 CPU & 512MB of RAM). 6 and 12 work well here. • MinSpareServers is the minimum number of threads waiting for requests while MaxSpareServers is the maximum number. Higher the number, more load the server can handle, however we have to balance the values with our server resources (1 CPU & 512MB of RAM). 6 and 12 work well here.
 +
 • MaxClients is the max number of simultaneous requests that will be served (any additional will be queued). 80 works well here. • MaxClients is the max number of simultaneous requests that will be served (any additional will be queued). 80 works well here.
-• MaxRequestsPerChild is the threshold after which a child process will re-spawn. For example, as any software, Apache can have memory leaks – so restarting the child process after a given number of requests served will clean up potentially leaked resources. 
  
-Disable default site+• MaxRequestsPerChild is the threshold after which a child process will re-spawn. For example, as any software, Apache can have memory leaks – so restarting the child process after a given number of requests served will clean up potentially leaked resources.** 
 + 
 +Configuration et réglage 
 + 
 +Maintenant qu'Apache est installé, nous devons régler, configurer et sécuriser le serveur Internet. 
 + 
 +D'abord le réglage. 
 + 
 +Théoriquement, le réglage est fait à la fin. Cela dit, j'ai tendance à oublier les réglages, ce qui me donne un serveur lent dès que la charge augmente. Donc réglons-les tout de suite, cela n'aura aucune conséquence. 
 + 
 +Éditez le fichier : /etc/apache2/apache2.conf, et ajoutez les instructions suivantes à la fin de celui-ci (pour Centos7, c'est : /etc/httpd/conf/httpd.conf) :  
 + 
 +sudo vi /etc/apache2/apache2.conf  
 + 
 +<IfModule mpm_prefork_module>  
 +  StartServers 2 
 +  MinSpareServers 6 
 +  MaxSpareServers 12 
 +  MaxClients 80 
 +  MaxRequestsPerChild 3000 
 +</IfModule>  
 + 
 +Pour que cela fasse effet, enregistrez le fichier et redémarrez le service Apache en tapant : 
 + 
 +sudo service apache2 restart (Centos7: systemctl restart httpd) 
 + 
 +Que signifie tout cela ? 
 +• StartServers définit le nombre minimum de serveurs enfants créés quand le serveur Web démarre. 2 fonctionne très bien pour moi et je ne sais pas exactement quelle est la valeur par défaut. 
 +• MinSpareServers est le nombre minimum de fils qui attendent des requêtes alors que MaxSpareServers est son nombre maximum. Plus le nombre est élevé et plus la charge que peut supporter le serveur est importante. Il faut toutefois équilibrer ces valeurs avec les capacités de notre serveur (1 CPU et 512 MB de RAM) Dans notre cas, 6 et 12 fonctionnent bien. 
 +• MaxClients est le nombre maximum de requêtes simultanées qui seront traîtées (toute requête supplémentaire sera mise en file d'attente). 80 fonctionne bien ici. 
 +•  MaxRequestsPerChild est la valeur au-delà de laquelle un serveur enfant se réinitialisera. Par exemple, comme tout logiciel, Apache peut avoir des fuites de mémoire ; ainsi, redémarrer la tâche enfant après un certain nombre de requêtes nettoiera d'éventuelles fuites. 
 + 
 +**Disable default site
  
 It is now time to disable the default site, meaning the page which was served when we keyed in the IP address of the server. Basically we want to do this for security and convenience reasons - when somebody keys in the IP address of my server, I'd rather send the user to my web page then the default Apache page. It is now time to disable the default site, meaning the page which was served when we keyed in the IP address of the server. Basically we want to do this for security and convenience reasons - when somebody keys in the IP address of my server, I'd rather send the user to my web page then the default Apache page.
Ligne 94: Ligne 160:
 • ServerName is the name of your website. • ServerName is the name of your website.
 • DocumentRoot is the path where the files of the web server are stored. • DocumentRoot is the path where the files of the web server are stored.
-• ErrorLog defines the path of where error logs are stored.+• ErrorLog defines the path of where error logs are stored.**
  
-We have therefore to create the path to these folders:+Désactiver le site par défaut 
 + 
 +Il est temps maintenant de désactiver le site par défaut, c'est-à-dire la page qui apparaissait quand on entrait l'adresse IP du serveur. Par principe, nous voulons faire cela pour des questions de sécurité et de praticité. Quand quelqu'un saisit l'adresse IP de mon serveur, je préfère envoyer l'utilisateur vers mes pages Internet plutôt que vers la page par défaut d'Apache. 
 + 
 +Il faut d'abord trouver le nom du site par défaut. 
 + 
 +Pour le désactiver, faire : 
 + 
 +sudo a2dissite 000-default 
 + 
 +Vérifiez maintenant le dossier « sites enabled » (sites activés) : le site  par défaut n'y est plus ! 
 + 
 +Redémarrez le serveur (service apache2 restart) ; pratiquement il n'y a plus de « site » affiché, simplement le dossier d'une arborescence : 
 + 
 +Créer notre site 
 + 
 +Le nom de notre site sera iceberg-tutorial.com (iceberg.com est déjà pris !) ; nous allons donc créer un fichier de configuration nommé iceberg-tutorial.conf (note : nous aurions pu choisir n'importe quel nom, je pars néanmoins du principe que donner au fichier de configuration le même nom qu'au site facilitera la maintenance à long terme) : 
 + 
 +sudo vi /etc/apache2/sites-available/iceberg-tutorial.conf 
 + 
 +Et ajoutez l'ensemble de ces lignes au fichier (pour Centos7, le fichier est /etc/httpd/conf.d) 
 + 
 +<VirtualHost *:80>  
 +   ServerAdmin your_email@here.com 
 +   ServerName iceberg-tutorial.com 
 +   ServerAlias *.iceberg-tutorial.com 
 +   DocumentRoot /var/www/iceberg-tutorial/public_html/ 
 +   ErrorLog /var/www/iceberg-tutorial/logs/error.log 
 +   CustomLog /var/www/iceberg-tutorial/logs/access.log combined 
 +</VirtualHost>  
 + 
 +Que signifie tout cela ? 
 + 
 +•  Apache écoute sur le port 80 (voir ci-dessous). 
 +•  Le nom du serveur est celui de notre site. 
 +•  DocumentRoot est le chemin de l'endroit où les fichiers du serveur sont stockés. 
 +•  ErrorLog est le chemin de l'endroit où les fichiers de rapports d'erreurs sont stockés. 
 + 
 +**We have therefore to create the path to these folders:
  
 sudo mkdir -p /var/www/iceberg-tutorial/public_html/ sudo mkdir -p /var/www/iceberg-tutorial/public_html/
Ligne 128: Ligne 232:
 We can see here that 22 (SSH) and 80 (http) are open – which is expected. We can see here that 22 (SSH) and 80 (http) are open – which is expected.
  
-To scan other port ranges, you can use the -p option (ex: nmap -p 2000-3000 localhost).+To scan other port ranges, you can use the -p option (ex: nmap -p 2000-3000 localhost).**
  
-Virtual Sites+Nous devons donc créer les chemins vers ces dossiers : 
 + 
 +sudo mkdir -p /var/www/iceberg-tutorial/public_html/ 
 + 
 +sudo mkdir -p /var/www/iceberg-tutorial/logs 
 + 
 +Et s'assurer que ces dossiers et fichiers peuvent être lus : 
 + 
 +sudo chmod -R 755 /var/www  
 + 
 +Et enfin mettre le site en ligne : 
 + 
 +sudo a2ensite iceberg-tutorial.conf 
 + 
 +Si nous essayons d'accéder au site, nous obtiendrons ceci – c'est le comportement prévu puisqu'il n'y a aucun fichier (nous n'avons créé que des dossiers) :  
 + 
 +Par défaut, Apache cherche un fichier nommé index.html – créons-le : 
 + 
 +sudo vi /var/www/iceberg-tutorial/public_html/index.html 
 + 
 +Tapons par exemple « Hello there » puis fermons et enregistrons. En rafraîchissant la page, vous devriez maintenant voir quelque chose du genre : 
 + 
 +Quelques notes rapides sur les ports TCP 
 + 
 +Nous avons déjà abordé les ports TCP lors de notre précédent article. Un excellent outil - pour déterminer quels sont les ports ouverts - est nmap. Pour scanner les 1 000 premiers ports, tapez : 
 + 
 +sudo nmap localhost 
 + 
 +et vous verrez quels sont les ports ouverts. 
 + 
 +Ici les ports 22 (SSH) et 80 (http) sont ouverts, comme prévu. 
 + 
 +Pour scanner d'autres séries de ports, on utilisera l'option -p (ex : nmap -p 2000-3000 localhost).  
 + 
 +**Virtual Sites
  
 It is possible to host several sites on the same server. Since the server has a unique IP address, the originating URL will help Apache go to the right site - in other words, serve the pages from the correct folder. It is possible to host several sites on the same server. Since the server has a unique IP address, the originating URL will help Apache go to the right site - in other words, serve the pages from the correct folder.
Ligne 144: Ligne 282:
 ... DocumentRoot /var/www/whatever-site/public_html/ ... ... DocumentRoot /var/www/whatever-site/public_html/ ...
  
-If the originating URL is www.iceberg-tutorial.com, Apache will serve the pages from /var/www/iceberg-tutorial/public_html/, while, if the originating URL is www.whatever-site.com, Apache will serve the pages from /var/www/whatever-site/public_html/+If the originating URL is www.iceberg-tutorial.com, Apache will serve the pages from /var/www/iceberg-tutorial/public_html/, while, if the originating URL is www.whatever-site.com, Apache will serve the pages from /var/www/whatever-site/public_html/**
  
-Security+Sites virtuels 
 + 
 +Il est possible d'héberger plusieurs sites sur le même serveur. Puisqu'un serveur a une adresse IP unique, l'URL demandé à l'origine aidera Apache à se diriger vers le bon site, en d'autres termes, fournir les pages en provenance du bon dossier. 
 + 
 +On peut donc avoir plusieurs fichiers de configuration dans le dossier /etc/apache2/sites-available/ 
 + 
 +Par exemple (souvenons-nous que pour des questions de maintenance, le nom du dossier est le nom du site) : 
 + 
 +iceberg-tutorial.conf 
 +... DocumentRoot /var/www/iceberg-tutorial/public_html/ ... 
 + 
 +whatever-site.conf  
 +... DocumentRoot /var/www/whatever-site/public_html/ ... 
 +  
 +Si l'URL voulu à l'origine est www.iceberg-tutorial.com, Apache fournira les pages de /var/www/iceberg-tutorial/public_html/ ; en revanche, si l'URL de la requête d'origine est www.whatever-site.com, Apache fournira les pages de /var/www/whatever-site/public_html/ 
 + 
 +**Security
  
 What would a web server setup be without security? It would probably be like leaving your car in the garage with the keys on the ignition – somebody may steal the car or not. Maybe it's not a great analogy, but you probably got the point! What would a web server setup be without security? It would probably be like leaving your car in the garage with the keys on the ignition – somebody may steal the car or not. Maybe it's not a great analogy, but you probably got the point!
Ligne 152: Ligne 306:
 Apache is open source software, therefore it is very easy to add modules and there are a bunch of security modules available. Apache is open source software, therefore it is very easy to add modules and there are a bunch of security modules available.
  
-Remember however that security is not foolproof – it is only a mitigating factor – so you must pro-actively check the system logs for intrusions or attempts of intrusion. Let's make another analogy – it's like you purchased that outstanding vault. Breaking into that vault will be difficult, but if an attacker has enough time and the right skills, he could potentially break inside. Same here – check frequently your system logs (more in the howto article on that).+Remember however that security is not foolproof – it is only a mitigating factor – so you must pro-actively check the system logs for intrusions or attempts of intrusion. Let's make another analogy – it's like you purchased that outstanding vault. Breaking into that vault will be difficult, but if an attacker has enough time and the right skills, he could potentially break inside. Same here – check frequently your system logs (more in the howto article on that).** 
 + 
 +Sécurité 
 + 
 +À quoi rimerait le paramétrage d'un serveur Web sans sécurité ? Ce serait probablement comme laisser votre voiture garée avec les clés sur le contact : il se pourrait que quelqu'un vole la voiture. L'exemple n'est peut-être pas très bien choisi, mais vous m'avez sûrement compris ! 
 + 
 +Apache est un logiciel Open Source, il est donc très facile d'ajouter des modules et il y a quantité de modules de sécurité disponibles. 
 + 
 +Souvenez-vous toutefois que la sécurité n'est pas à toute épreuve, c'est simplement un facteur limitant ; vous devez donc rechercher activement dans les journaux système des intrusions ou des tentatives d'intrusion. Faisons une autre analogie : c'est comme si vous aviez acheté un superbe coffre-fort. Entrer par effraction dans ce coffre-fort serait très difficile. Mais en supposant qu'une personne ait suffisamment de temps et les bonnes compétences, elle pourrait potentiellement le forcer. Même chose ici, vérifiez fréquemment vos journaux système (pour plus d'information, voir le tutoriel sur ce sujet).
  
-Out of the box security+**Out of the box security
  
 By “out of the box” is meant that no download is required – just add all below to the end of the file /etc/apache2/apache2.conf: By “out of the box” is meant that no download is required – just add all below to the end of the file /etc/apache2/apache2.conf:
Ligne 186: Ligne 348:
 • TraceEnabled doesn't allow debugging (additional trace) and TimeOut is probably self explanatory! • TraceEnabled doesn't allow debugging (additional trace) and TimeOut is probably self explanatory!
 • The Directory directive adds restrictions on root folder. • The Directory directive adds restrictions on root folder.
-• As explained earlier, Apache can easily be enhanced with modules. Here we ask Apache to load the headers_module, which will be used in the 2 commands below (Header Edits … and Header always …) in order to block XSS or using iFrames attacks. I am not an expert on these topics – my recommendation is copy-paste the entire line (Header Edits … and Header always …) into Google for more details.+• As explained earlier, Apache can easily be enhanced with modules. Here we ask Apache to load the headers_module, which will be used in the 2 commands below (Header Edits … and Header always …) in order to block XSS or using iFrames attacks. I am not an expert on these topics – my recommendation is copy-paste the entire line (Header Edits … and Header always …) into Google for more details.**
  
-Additional security – module ModSecurity for Apache+Sécurité par défaut 
 + 
 +Par « par défaut » j'entends sans téléchargement, ajoutez simplement les lignes suivantes à la fin de votre fichier /etc/apache2/apache2.conf : 
 + 
 +ServerTokens Prod 
 +ServerSignature Off 
 + 
 +FileETag None 
 +TraceEnable off 
 +Timeout 60 
 + 
 +<Directory />  
 +    Options None 
 +    AllowOverride None 
 +    Order deny,allow 
 +   
 +    <LimitExcept GET POST HEAD> 
 +    deny from all 
 +   </LimitExcept> 
 +</Directory> 
 + 
 +LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so 
 + 
 +Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure 
 + 
 +Header always append X-Frame-Options SAMEORIGIN 
 + 
 +Commentaire rapide sur la signification de tout cela : 
 +• ServerTokens et ServerSignature ne donneront pas la version d'Apache (la signature du serveur sera juste Apache). Cela évite de donner à un pirate des informations concernant les exploits spécifiques de votre version (comme par exemple – version 1.4.2 a la faille XXX connue). 
 +• TraceEnabled ne permet pas le débogage (une trace additionnelle) et TimeOut est sans doute explicite ! 
 +• Les ordres concernant le Directory (répertoire) ajoutent des restrictions sur le dossier racine. 
 +• Comme expliqué plus haut, on peut facilement améliorer Apache avec des modules. Ici nous demandons à Apache de charger le module headers qui sera utilisé dans deux commandes ci-dessous. (Header Edits… et Header always…) de façon à bloquer des attaques de type XSS ou utilisant iFrames. Je ne suis pas spécialiste de ces sujets, ma recommandation serait de copier-coller dans Google la ligne entière (Header Edits… et Header always…) pour plus de détails. 
 + 
 +**Additional security – module ModSecurity for Apache
  
 Extremely popular for Apache servers (and maybe others), ModSecurity is a must-have module. Note this is not mandatory, however I highly recommend installing it (it's free and it adds security – so why not?). Extremely popular for Apache servers (and maybe others), ModSecurity is a must-have module. Note this is not mandatory, however I highly recommend installing it (it's free and it adds security – so why not?).
Ligne 194: Ligne 389:
 Once ModSecurity is installed, it doesn't do anything out of the box – you must turn on what options you need. To make things easier, common rules (also called CRS - Core Set Rules) are available and just need to be turned on. Once ModSecurity is installed, it doesn't do anything out of the box – you must turn on what options you need. To make things easier, common rules (also called CRS - Core Set Rules) are available and just need to be turned on.
  
-There are many websites with all the instructions on how to install ModSecurity and turn on CRS – for all step-by-step instructions, please follow the link below (there are many other tutorials available online on how-to proceed): https://www.digitalocean.com/community/tutorials/how-to-set-up-modsecurity-with-apache-on-ubuntu-14-04-and-debian-8+There are many websites with all the instructions on how to install ModSecurity and turn on CRS – for all step-by-step instructions, please follow the link below (there are many other tutorials available online on how-to proceed): https://www.digitalocean.com/community/tutorials/how-to-set-up-modsecurity-with-apache-on-ubuntu-14-04-and-debian-8**
  
-Cleanup and some statistics+Sécurité supplémentaire – module ModSecurity pour Apache 
 + 
 +Très courant pour les serveurs Apache (et peut-être pour d'autres), ModSecurity est un module que vous devez installer. Notez que ce n'est pas obligatoire, toutefois il est hautement recommandé de le faire (il est gratuit et rajoute de la sécurité, alors, pourquoi pas ?). 
 + 
 +Une fois installé, ModSecurity ne fait rien par défaut, vous devez activer les options dont vous avez besoin. Pour faciliter les choses, des règles communes (appelées aussi CRS – Core Set Rules, ensemble des règles de base) sont disponibles et ont juste besoin d'être activées. 
 + 
 +Il y a un tas de sites Internet donnant les instructions d'installation de ModSecurity et d'activation de CRS. Pour des instructions étape par étape, suivez le lien ci-dessous (il y a beaucoup de tutoriels en ligne expliquant comment procéder) : https://www.digitalocean.com/community/tutorials/how-to-set-up-modsecurity-with-apache-on-ubuntu-14-04-and-debian-8 
 + 
 +**Cleanup and some statistics
  
 The folder /var/www/iceberg-tutorial/logs will start filling up with logs: The folder /var/www/iceberg-tutorial/logs will start filling up with logs:
Ligne 204: Ligne 407:
 We can now also run statistics – what pages were open, IP source, browser info, … etc. Of course, you can use Google analytics; however as a pure geek, I personally enjoyed browsing the web logs to get my own stats. We can now also run statistics – what pages were open, IP source, browser info, … etc. Of course, you can use Google analytics; however as a pure geek, I personally enjoyed browsing the web logs to get my own stats.
  
-Note that the log file size will continue increasing – so we must clean it up. This very small script (shown on the next page)will count all unique access to the web server and then compress the log. It's a bash job, all lines starting with # are comments. Once the script is created, you can add the script to a cron job to run daily:+Note that the log file size will continue increasing – so we must clean it up. This very small script (shown on the next page)will count all unique access to the web server and then compress the log. It's a bash job, all lines starting with # are comments. Once the script is created, you can add the script to a cron job to run daily:**
  
-Final Note – website registration and DNS+Nettoyage et quelques statistiques 
 + 
 +Le dossier /var/www/iceberg-tutorial/logs va commencer à se remplir de journaux : 
 + 
 +Allez voir dans access.log. Vous y verrez l'adresse IP à partir de laquelle vous avez accédé au serveur Web (c'est-à-dire là où le navigateur tournait) ; c'est sympa, non ? 
 + 
 +Nous pouvons aussi obtenir des statistiques : quelles pages ont été ouvertes, l'IP de la source, des informations sur le navigateur, etc. Vous pouvez bien sûr utiliser Google Analytics ; mais, comme un vrai geek, je préfère personnellement explorer les journaux Web pour obtenir mes propres statistiques. 
 + 
 +Remarquez que la taille des fichiers journaux n'arrêtera pas d'augmenter, on doit donc les nettoyer. Le tout petit programme (page suivante) comptera tous les accès uniques au serveur Web et compressera le journal. C'est une routine bash, toutes les lignes commençant par # sont des commentaires. Une fois que le programme est créé, vous pouvez l'ajouter dans une tâche cron quotidienne : 
 + 
 +**Final Note – website registration and DNS
  
 Once the web server is set up and pages ready, you will probably register a website name – it is easier to remember www.iceberg-tutorial.com rather than 159.203.90.111. Once the web server is set up and pages ready, you will probably register a website name – it is easier to remember www.iceberg-tutorial.com rather than 159.203.90.111.
Ligne 216: Ligne 429:
 All information on theses steps is very well explained here: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-host-name-with-digitalocean All information on theses steps is very well explained here: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-host-name-with-digitalocean
  
-I hope you have enjoyed these articles and that you will create your own website, from scratch!+I hope you have enjoyed these articles and that you will create your own website, from scratch!** 
 + 
 +Note finale – Enregistrement du site et DNS 
 + 
 +Une fois que le serveur est monté et que les pages sont prêtes, vous allez probablement enregistrer un nom de site ; il est plus facile de se souvenir de iceberg-tutorial.com que de 159.203.90.111. 
 + 
 +Pour faire cela, allez sur votre registrar en ligne favori et suivez toutes les étapes (il faudra payer quelque chose, c'est habituellement de l'ordre de 15 $ par an). 
 + 
 +Vous devrez alors créer une entrée DNS à Digital Ocean, c'est le lien qui détermine où doit aller le navigateur quand quelqu'un veut accéder à www.iceberg-tutorial.com (pas de coût supplémentaire, enfin quelque chose de gratuit !). 
 + 
 +Toutes les informations sur ces étapes sont très bien expliquées ici : https://www.digitalocean.com/community/tutorials/how-to-set-up-a-host-name-with-digitalocean 
 + 
 +J'espère que vous avez apprécié ces articles et que vous créerez votre propre site internet, à partir de zéro !
issue102/tutoriel_2.1446400503.txt.gz · Dernière modification : 2015/11/01 18:55 de auntiee