Outils pour utilisateurs

Outils du site


Panneau latéral

linux:pound (lu 33418 fois)

Ceci est une ancienne révision du document !


Pound : reverse proxy / load ballancer

Installons maintenant pound qui permet le reverse-proxy et load-balancer

aptitude install pound

Voici notre 1ère règle de config de pound

ListenHTTP
        Address 70.70.70.70
        Port    80

        ## allow PUT and DELETE also (by default only GET, POST and HEAD)?:
        xHTTP           0

        Service
                HeadRequire "Host: .*www.p2pfr.com.*"
                BackEnd
                        Address 192.168.0.2
                        Port    80
                End
        End
End
HeadRequire supporte les expressions régulières, par exemple pour l’adresse www.p2pfr.com et p2pfr.com fonctionne écrivez ceci :
"Host: .*(.p2pfr|p2pfr).com.*"

Pour tolérer 2 sites

"(Host: .*(.p2pfr|p2pfr).com.*|Host: .*(.p2pfr2|p2pfr2).com.*)"

Lancez pound

/etc/init.d/pound start

Mais comme le dis le message d’erreur

pound will not start unconfigured. (warning).
Please configure; afterwards, set startup=1 in /etc/default/pound. (warning).

Vous devez modifiez le fichier /etc/defaults/pound et mettre startup=1 puis

/etc/init.d/pound start

Configurer Apache : LogFormat poundCombined

Comme le dit la page http://blog.phondroid.fr/?p=102

Si vous utilisez awstats ou un autre soft de statistique, on ne verra que le serveur proxmox comme étant l’unique visiteur du site ce qui peut être rageant…

Pas de panique donc, le site cité ci dessus nous donne la solution.

Modifiez votre fichier de config de site apache, allez dans la section log et ajoutez cette ligne dans les types de log

 LogFormat "\"%{X-Forwarded-for}i\" %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{forensic-id}n\"" poundcombined

Ensuite modifier la variable suivante

CustomLog /var/log/apache2/access.log poundcombined

Récupérer les log de pound

source : http://myfreshthoughts.blogspot.fr/2008/07/howto-tell-pound-to-log-into-its-own.html

Normally, sysklogd will overtake all messages from pound and will put them into syslog as anything with the facility ‘daemon’ goes in there by default. So first you need to change the LogFacility of pound as it is ‘daemon’ by default.

Just edit your /etc/pound.conf as follows:

#facility local0 is needed as sysklogd will
#seperate pound messages by this facility
LogFacility local0
LogLevel 3

And the change your /etc/rsyslog.conf

###############
#### RULES ####
###############

#
# First some standard log files.  Log by facility.
#
*.*;auth,authpriv.none,local0.none          -/var/log/syslog
# get the messages with the facility local0 and
# log them into the pound logfile 
local0.* -/var/log/pound.log

The next step is to make sure that there is always a pound.log present. Therefore you need to modify the start script by adding a short conditional block into the top section of /etc/init.d/pound.

# Check if the pound.log exists, if not create one
if [ ! -e "/var/log/pound.log" ]
then
  log_warning_msg "There is no pound.log, i'll create one"
  touch /var/log/pound.log
  chmod 0644 /var/log/pound.log
  chown syslog:adm /var/log/pound.log
  /etc/init.d/sysklogd reload > /dev/null
  else
  log_success_msg "pound.log was found"
  /etc/init.d/sysklogd reload > /dev/null
fi

After you reloaded the sysklogd by /etc/init.d/sysklogd reload and restarted the pound, you should see the first log entries.

In my case the logfile increased to a size of more than 900 Mbyte after 24 hours, so don’t forget to rotate the log. This could be done like this (/etc/logrotate.d/pound)

/var/log/pound.log {
  daily
  missingok
  rotate 14
  dateext 
  compress
  notifempty
  create 0644 syslog adm
  postrotate
  /etc/init.d/sysklogd reload > /dev/null
  endscript

}

linux/pound.1354525215.txt.gz · Dernière modification: 04-04-2013 22:05 (modification externe)