Se utilizzate Reverse Proxy su apache e vedete nei log un messaggio del genere
[Thu Nov 04 15:24:14 2010] [error] (13)Permission denied: proxy: HTTP: attempt to connect to 192.168.xx.xx:8081 (xxx) failed
[Thu Nov 04 15:24:14 2010] [error] ap_proxy_connect_backend disabling worker for (xxx)
[Thu Nov 04 15:24:28 2010] [error] proxy: HTTP: disabled connection for (xxx)
[Thu Nov 04 15:26:21 2010] [error] (13)Permission denied: proxy: HTTP: attempt to connect to 192.168.xx.xx:8081 (xxx) failed
[Thu Nov 04 15:26:21 2010] [error] ap_proxy_connect_backend disabling worker for (xxx)
Allora avete un problema di configurazione nell’apache, ed in particolare lui non puo connettersi alle altre macchine. Per risolvere questo problema eseguite seguente commando:
setsebool httpd_can_network_connect 1
o
setsebool httpd_can_network_connect true
Oppure si può spuntare nelle policy di SELinux seguente voce:
“Allow HTTPD scripts and modules to connect to the network”
sotto il servizio httpd.
Premessa: questa è la configurazione per failover (non loadbalancing) di due macchine centos in modalità MASTER-SLAVE. Entrambe le macchine hanno una scheda di rete ed il loro ip virtuale (192.168.1.160) si trova sulla stessa rete degli ip veri (192.168.1.16x)
Internet--
|
|
|
|-lb0==|eth1 -> 192.168.1.161 (lan)
| |------> 192.168.1.160 (vip master)
|
|
|-lb1==|eth1 -> 192.168.1.162 (lan)
|------> 192.168.1.160 (vip backup)
Installazione dei prerequisiti
yum -y install kernel-headers kernel-devel gcc gcc-c++ autoconf automake openssl openssl-devel
Continua…
update-rc.d -f apache2 remove
Per visualizzare i moduli caricati dentro apache si può utilizzare il commando
apache2 -t -D DUMP_MODULES
Nel caso in cui il commando di cui sopra dovess fallire con errore
apache2: bad user name ${APACHE_RUN_USER}
Utilizzate questa serie di commandi
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
apache2 -t -D DUMP_MODULES
Da questo post:
1 vote down
Here’s a solution which will loop over key/value pairs in your URL:
RewriteRule ^cat_ap~([^~]+)~([^~]+)(.*)\.htm$ cat_ap$1?$1=$2 [R,QSA]
RewriteRule ^cat_ap(.*)\.htm$ /urban/cat_ap.php [L]
It grabs the first pair off the URL, then rewrites it to the exact same URL without that pair, adds the pair to the query string ([QSA]) and starts the rewriting process over again ([R]). When there are no more key/value pairs in the URL, it rewrites it to your script’s location and terminates rewriting ([L]).
cat_ap~pnid~290~nid~96666~posters~Sports.htm => /urban/cat_ap.php?posters=Sports&nid=96666&pnid=290
cat_ap~PageNum_GetProduct~10~nid~290.htm => /urban/cat_ap.php?nid=290&PageNum_GetProduct=10
(Note that the order of parameters is reversed; this will only matter if the same parameter appears more than once.)
Creare lo script nella cartella desiderata
vim scriptname.php
Continua…
Premessa:
A volte può capitare di non poter utilizzare le porte predefenite per interfacce web di vari servizi come Utorrent e Emule (per esempio se al posto di lavoro potete uscire solamente sulla porta 80). Certo, potete sempre impostare il programma che vi interessa in modo che ascolti sulla porta 80 però non potete averne più di una sulla stessa porta.
La soluzione a questo problema è abbastanza semplice: reverse_proxy di Apache. E’ possibile impostare apache in modo tale che quando visitate una particolare percorso esso vi redirige in modo del tutto trasparente su un altra porta pur rimanendo sempre sulla 80.
Ecco che cosa dovete fare (in questo esempio utilizzero utorrent come interfaccia web da redirigere)
Continua…