Outils pour utilisateurs

Outils du site


www_apache2

Différences

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

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
www_apache2 [2012/01/12 13:17] thierrywww_apache2 [2012/05/10 20:49] (Version actuelle) thierry
Ligne 1: Ligne 1:
 ====== Apache2 ====== ====== Apache2 ======
 +===== Catch-all =====
 +
 +Lien: http://michauko.org/blog/2012/03/28/catch-all-dns-virtualhost-et-on-fait-mumuse-avec-les-noms-de-sous-domaines/
 +
 +" Catch-all DNS, VirtualHost et on fait mumuse avec les noms de sous-domaines " ... a suivre.
 +
 ===== Stress avec Curl-Loader ===== ===== Stress avec Curl-Loader =====
  
Ligne 57: Ligne 63:
 Donc: Donc:
   # ulimit -n 10000   # ulimit -n 10000
 +
 +==== Exemples de conf ====
 +
 +En pratique:
 +
 +J'ai fait des tests en utilisant des machines virtuels, dans un reseau virtualisé avec des interfaces "dummy".
 +
 +Les principaux interets:
 +  *le reseau est hyper rapide (estimé à 10Gb/s!) puisque tout passe en RAM 
 +  *ce reseau etant vierge, je suis libre d'y mettre n'importe quoi, y compris 2000 IPs :) 
 +
 +Voici une conf de test, largement inspiré de l'exemple "10K.conf".
 +  ########### GENERAL SECTION ################################
 +  BATCH_NAME= test  
 +  CLIENTS_NUM_MAX=10000
 +  CLIENTS_NUM_START=50
 +  CLIENTS_RAMPUP_INC=25
 +  INTERFACE=eth1    
 +  NETMASK=17  
 +  IP_ADDR_MIN= 192.168.128.32
 +  IP_ADDR_MAX= 192.168.191.255  #Actually - this is for self-control
 +  CYCLES_NUM= 5
 +  URLS_NUM= 3
 +  
 +  ########### URL SECTION ####################################
 +  
 +  URL=http://www.thierry-jaouen.fr/index.html
 +  URL_SHORT_NAME="www-index"
 +  REQUEST_TYPE=GET
 +  TIMER_URL_COMPLETION = 1500      # In msec. When positive, Now it is enforced by cancelling url fetch on timeout
 +  TIMER_AFTER_URL_SLEEP = 20
 +  
 +  ###
 +  
 +  URL=http://www.thierry-jaouen.fr/cgi-bin/agenda?action=query&year=2012&month=-1&style=gogol-the-first
 +  URL_SHORT_NAME="www-agenda"
 +  REQUEST_TYPE=GET
 +  TIMER_URL_COMPLETION = 5000      # In msec. When positive, Now it is enforced by cancelling url fetch on timeout
 +  TIMER_AFTER_URL_SLEEP = 2500
 +  
 +  ###
 +  
 +  URL=http://www.thierry-jaouen.fr/music/Devin_Townsend/Devin_Townsend_-_2011_-_Contain_Us/CD1/01_Synchronicity_Freaks.mp3
 +  URL_SHORT_NAME="www-music"
 +  REQUEST_TYPE=GET
 +  TIMER_URL_COMPLETION = 5000      # In msec. When positive, Now it is enforced by cancelling url fetch on timeout
 +  TIMER_AFTER_URL_SLEEP = 500
 +  
 +  ###
 +
 +
 +Donc, on va faire notre test en communicant via eth1 , avec beaucoup d'IP.
 +
 +  # curl-loader test.conf
 +
 +Voila.
  
 ===== Log Syslog ===== ===== Log Syslog =====
Ligne 243: Ligne 305:
   # /etc/init.d/nginx restart   # /etc/init.d/nginx restart
  
 +
 +Avec "rpaf", il faut modifier l'adresse local du proxy en editant "rpaf.conf" , pour par exemple:
 +  RPAFproxy_ips <IP_DU_PROXY>
  
 ==== Logs ==== ==== Logs ====
Ligne 304: Ligne 369:
  
 Voila. Voila.
 +
 +==== https reverse proxy ====
 +
 +Liens:
 +  *http://www.cyberciti.biz/faq/howto-linux-unix-setup-nginx-ssl-proxy/
 +  *http://thomaswabner.wordpress.com/2009/11/17/create-self-signed-multi-domain-certificate/
 +  *http://nginx.org/en/docs/http/configuring_https_servers.html
 +
 +Soit un domain: toto.mondomain.fr
 +
 +  export NAME=toto.mondomain.fr
 +  
 +  openssl genrsa -des3 -out $NAME.key 1024
 +(entrer une passe phrase provisoire)
 +  openssl req -new -key $NAME.key -out $NAME.csr
 +
 +CN:toto.mondomain.fr
 +
 +Virer la pass-phrase:
 +  cp $NAME.key $NAME.key.bak
 +  openssl rsa -in $NAME.key.bak -out $NAME.key
 +
 +=== 1 domaine ===
 +
 +Un seul domaine
 +
 +  openssl x509 -req -days 3650 -in $NAME.csr -signkey $NAME.key -out $NAME.crt
 +
 +Les clefs sont prêtes.
 +
 +=== multi-domaine ===
 +
 +Lien: http://thomaswabner.wordpress.com/2009/11/17/create-self-signed-multi-domain-certificate/
 +
 +Il faut mettre plusieurs domaines dans le certificat de la facon suivante:
 +
 +Créer un fichier "$NAME.domain_extensions.txt" contenant :
 +<code>
 +[ mydomain_http ]
 +nsCertType      = server
 +keyUsage        = digitalSignature,nonRepudiation,keyEncipherment
 +extendedKeyUsage        = serverAuth
 +subjectKeyIdentifier    = hash
 +authorityKeyIdentifier  = keyid,issuer
 +subjectAltName          = @mydomain_http_subject
 +[ mydomain_http_subject ]
 +DNS.1 = sub1.mondomain.fr
 +DNS.2 = sub2.mondomain.fr
 +... etc ...
 +DNS.x = xxxx.mondomain.fr
 +</code>
 +
 +Et enfin
 +  openssl x509 -req -days 3650 -in $NAME.csr -signkey $NAME.key -out $NAME.crt -extfile $NAME.domain_extensions.txt -extensions mydomain_http
 +
 +Et voila: tout les domaines "DNS.1" a "DNS.x" sont associés aux clefs.
 +
 +| :!: Il serai aussi possible d'utiliser "*.mondomain.fr" |
 +
 +=== nginx ===
 +
 +FIXME : Un exemple, mais je n'ai pas tout compris... 
 +
 +  server {
 +  listen 443;
 +  server_name .thierry-jaouen.fr .tjaouen.fr;
 +  
 +  ssl on;
 +  ssl_certificate /etc/nginx/ssl/thierry-jaouen.fr.crt;
 +  ssl_certificate_key /etc/nginx/ssl/thierry-jaouen.fr.key;
 +  
 +  keepalive_timeout 60;
 +  
 +  location / {
 +    proxy_pass http://wwwcave.local.eez.fr:80/;
 +    access_log off;
 +  
 +    proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
 +  
 +    ### Set headers ####
 +    proxy_set_header Host $host;
 +    proxy_set_header X-Real-IP $remote_addr;
 +    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 +   
 +    ### Most PHP, Python, Rails, Java App can use this header ###
 +    proxy_set_header X-Forwarded-Proto https;
 +   
 +    ### By default we don't want to redirect it ####
 +    proxy_redirect     off;
 +  }
 +  
 +  }
 +
 +Le "https" est alors géré entre le client et **''nginx''** .
 +
 +**MAIS** , entre **''nginx''** et le serveur apache, ce n'est que du **''http''** .
 +
 +C'est pour cela que le flag "X-Forwarded-Proto https" est fixé.
 +
 +Ainsi, pour vos règles de **''rewrite''**, par exemple:
 +
 +Remplacer: 
 +| **''RewriteCond %{SERVER_PORT} !^443$''** |
 +par
 +| **''RewriteCond %{HTTP:X-Forwarded-Proto} !^https$''** |
  
 ===== Apache HA ===== ===== Apache HA =====
Ligne 490: Ligne 660:
  
  
-====== evasive ====== +====== Anti DoS ou evasive ====== 
-Protection contre DOS, etc ... +Protection contre DoS, etc ... 
  
-Lien: http://www.debianadmin.com/how-to-protect-apache-against-dosddos-or-brute-force-attacks.html+Liens: 
 +  *http://www.bortzmeyer.org/limit-apache.html 
 +  *http://www.debianadmin.com/how-to-protect-apache-against-dosddos-or-brute-force-attacks.html
  
 ====== webalizer ====== ====== webalizer ======
Ligne 709: Ligne 881:
 Et voila ? Et voila ?
  
 +Bug corrigé.
      
  
www_apache2.1326374226.txt.gz · Dernière modification : 2012/01/12 13:17 de thierry