Administration des Services Web

De wikilivois
Révision datée du 28 mai 2012 à 20:31 par Christophe (discussion | contributions) (1 version)
(diff) ← Version précédente | Voir la version actuelle (diff) | Version suivante → (diff)
Aller à la navigationAller à la recherche
La version imprimable n’est plus prise en charge et peut comporter des erreurs de génération. Veuillez mettre à jour les signets de votre navigateur et utiliser à la place la fonction d’impression par défaut de celui-ci.

Gestion des logs

apache2.conf

Avec apache2.2, la configuration des logs sort de httpd.conf et se retrouve dans modules/00_mod_log_config.conf.

<licode file=/etc/apache2/modules.d/00_mod_log_config.conf> <IfModule log_config_module>

  1. The following directives define some format nicknames for use with
  2. a CustomLog directive (see below).

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %>s %b" common

LogFormat "%{Referer}i -> %U" referer LogFormat "%{User-Agent}i" agent LogFormat "%v %h %l %u %t \"%r\" %>s %b %T" script LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i" vhost

<IfModule logio_module>

       # You need to enable mod_logio.c to use %I and %O
       LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

</IfModule>

  1. The location and format of the access logfile (Common Logfile Format).
  2. If you do not define any access logfiles within a <VirtualHost>
  3. container, they will be logged here. Contrariwise, if you *do*
  4. define per-<VirtualHost> access logfiles, transactions will be
  5. logged therein and *not* in this file.

CustomLog /var/log/apache2/access_log common CustomLog /var/log/apache2/multiple_vhost_log vhost

  1. CustomLog "|/usr/sbin/split-logfile" vhost env=VLOG
  1. If you would like to have agent and referer logfiles,
  2. uncomment the following directives.
  3. CustomLog /var/log/apache2/referer_log referer
  4. CustomLog /var/log/apache2/agent_logs agent
  1. If you prefer a logfile with access, agent, and referer information
  2. (Combined Logfile Format) you can use the following directive.
  3. CustomLog /var/log/apache2/access_log combined

</IfModule> </licode>

Pour les "virtualhost", la configuration se fait dans le fichier de configuration associé:

<licode file=/etc/apache2/vhosts.d/www.livois.com.conf> <VirtualHost *:80>

 ServerName www.livois.com
 #ServerAlias *.livois.com
 DocumentRoot /var/www/www.livois.com
 CustomLog /var/log/apache2/www.livois.com.log combined
 RewriteEngine on
 RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
 RewriteRule .* - [F]

</VirtualHost> </licode>

Les logs se trouvent alors dans : /var/log/apache2/www.livois.com.log, grâce à la ligne CustomLog

Webalizer

ftp://ftp.mrunix.net/pub/webalizer/README

http://www.patrickfrei.ch/webalizer/

Package Gentoo: webalizer (+geoip, +xtended)

Pour utiliser le patech extended (affichage des erreurs 404 et io), il est préférable d'utiliser le mode mod_logio d'apache afin de comptabiliser le nombre d'octets envoyé/reçu par site web.

<licode file=/etc/apache2/vhosts.d/www.livois.com.conf> <VirtualHost *:80> ...

 CustomLog /var/log/apache2/www.livois.com.log combinedio

... </VirtualHost>

</licode>

#webalizer -p -n www.livois.com -Q -o /var/www/www.livois.com/webalizer/var/log/apache2/www.livois.com.log

-p 		incremental (conserve les données après chaque passage)
-Q 		mode silencieux
-o 		$WEB/webalizer (repertoire des fichiers html d’output)

Dans la crontab: <licode file=/etc/crontab> 0 0 * * * root webalizer -o /var/www/www.livois.com/webalizer/ -p -Q -n www.livois.com /var/log/apache2/www.livois.com.log </licode>

Awstats

http://awstats.sourceforge.net/docs/index.html

Installation

Package Gentoo: awstats

#cp /etc/awstats/awstats.model.conf /etc/awstats/awstats.www.livois.com.conf


<licode file=/etc/awstats/awstats.www.livois.conf> LogFile="/var/log/apache2/VLOG-%YYYY-0-%MM-0-www.livois.com.log" DirData="/etc/awstats/datadir/" DirCgi="/awstats/cgi-bin" DirIcons="/awstatsicons" </licode>

Remarque Gentoo : Vérifier la présence de vhosts dans USE de /etc/make.conf.
Awstats est installé dans le répertoire /usr/share/webapps/awstats/<version>
Les données sont /usr/share/webapps/awstats/<version>/hostroot/datadir/

Configuration Apache: <licode file=/etc/apache2/vhosts.d/www.livois.com.conf> AddHandler cgi-script .cgi .pl Alias /awstatsclasses "/usr/share/webapps/awstats/<version>/htdocs/classes/" Alias /awstatscss "/usr/share/webapps/awstats/<version>/htdocs/css/" Alias /awstatsicons "/usr/share/webapps/awstats/<version>/htdocs/icon/" ScriptAlias /awstats/ "/usr/share/webapps/awstats/<version>/hostroot/cgi-bin/" </licode>

Installation du plugin GeoIP

Package Gentoo: geoip Geo-IP

<licode file=/etc/awstats/awstats.www.livois.com.conf>

  1. Plugin: GeoIP
  2. Perl modules required: Geo::IP or Geo::IP::PurePerl (from Maxmind)
  3. Country chart is built from an Internet IP-Country database.
  4. This plugin is useless for intranet only log files.
  5. Note: You must choose between using this plugin (need Perl Geo::IP module
  6. from Maxmind, database more up to date) or the GeoIPfree plugin (need
  7. Perl Geo::IPfree module, database less up to date).
  8. This plugin reduces AWStats speed of 8% !

LoadPlugin="geoip GEOIP_STANDARD /usr/share/GeoIP/GeoIP.dat" </licode>

Génération des pages awstats

#perl awstats.pl -config=www.livois.com -update
#perl awstats.pl -config=www.livois.com -output -staticlinks > ../index.html

Aller sur la page web: http://monsite/awstats/awstats.pl?config=www.livois.com

Outils d'administration

apache2 (server-status, server-info, ldap-status)

Je configure (activable avec l'option -D dans /etc/conf.d/apache2)

  • server-info
  • server-status

<licode file=/etc/apache2/httpd.conf>

  1. Allow server status reports generated by mod_status,
  2. with the URL of http://servername/server-status
  3. Change the ".example.com" to match your domain to enable.

<IfDefine INFO>

   ExtendedStatus On
   <Location /server-status>
       SetHandler server-status
       Order deny,allow
       Deny from all
       Allow from 192.168.10.1/24
   </Location>

</IfDefine> </licode>

Apachetop

Package Gentoo: apachetop

Phpmyadmin

Package Gentoo: phpmyadmin

Vérifier la présence de vhosts dans USE de /etc/make.conf

#webapp-config -I -h www.livois.com -d phpmyadmin phpmyadmin VERSION
#mysql -u root -p < /usr/share/webapps/phpmyadmin/VERSION/sqlscripts/mysql/VERSION_create.sql


<licode file=/etc/vhosts/webapp-config> VHOST_HTDOCS_INSECURE="." (remplacer htdocs par « . ») </licode>

#webapp-config --list-installs phpmyadmin


<licode file=/var/www/www.livois.com/phpmyadmin/config.inc.php> $cfg['Servers'][$i]['auth_type'] = 'cookie'; $cfg['PmaAbsoluteUri'] = 'http://www.livois.com/supervision/phpmyadmin'; $cfg['blowfish_secret'] = 'secretblowishutilisedanslecookie; $cfg['Servers'][$i]['controlpass'] = 'n°quichangeachaqueversiondephpmyadmin'; </licode>

A partir de la version 2.8.0.2, il est possible d'éditer le fichier de configuration à travers scripts/setup.php:

#cd phpmyadmin
#mkdir config                        # create directory for saving
#chmod o+rw config                   # give it world writable permissions
# if you want to edit existing configuration:
#cp config.inc.php config/           # copy current configuration
#chmod o+w config/config.inc.php     # give it world writable permission

Administration ftp

  • ftpwho
  • ftptop
  • ftpquota -show-records --type tally --table-path /etc/proftpd/ftpquota.tallytab

Sites web

http://www.selfseo.com/website_speed_test.php - test de rapidité du site.

Copyright

© 2006-2007 Christophe de Livois

Tête de GNU Vous avez l'autorisation de copier, distribuer et/ou modifier ce document suivant les termes de la GNU Free Documentation License, Version 1.2 ou n'importe quelle version ultérieure publiée par la Free Software Foundation; sans section invariante, sans page de garde, sans entête et sans page finale. Pour plus d'informations consulter le site de l'APRIL.