Apache重定向与mod_proxy,mod_rewrite

时间:2015-02-19 07:54:35

标签: linux apache mod-rewrite ssl mod-proxy

我需要使用Apache,mod_rewrite,mod_proxy进行configureproxy重定向。 我有下一个:

WEBLogic Node1: ip: 10.0.0.3 port:7003 (not SSL)
WEBLogic Node2: ip: 10.0.0.4 port:7004 (not SSL)
WEBLogic Apache: ip: 10.0.0.5 ports: 80,443 (Apache Server Balancer)

结果我应该得到:

http://10.0.0.5/manage (redirect) -> httpS://10.0.0.5/faces/login (In browser user must see /manage) -> HTTP balancer
httpS://10.0.0.5/manage (redirect)-> httpS://10.0.0.5/faces/login (In browser user must see /manage) -> HTTP balancer

Server 10.0.0.5具有WEBLogic节点的HTTP平衡器:1,2

我接下来配置:

NameVirtualHost *:80
NameVirtualHost *:443

<VirtualHost *:80>
<IfModule mod_rewrite.c>
RewriteEngine On
# log
RewriteLog /var/log/mod_rewrite.log
RewriteLogLevel 6

# redirect to SSL connection
RewriteCond %{REQUEST_URI}  ^/manage/?$
RewriteCond %{SERVER_PORT} 80
# R=301 sends HTTP Moved Permanently L=Last rule for this request
RewriteRule ^(.*)$ https://%{SERVER_NAME}/faces/login [R,L]
</IfModule>

</VirtualHost>

<VirtualHost *:443>
# SSL
SSLEngine on
SSLProxyEngine On
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:!LOW:!SSLv2:!EXPORT
SSLCertificateFile /etc/apache2/certs/host.pem
SSLCertificateKeyFile /etc/apache2/certs/host.key


# mod_rewrite
<IfModule mod_rewrite.c>
RewriteEngine On
# log
RewriteLog /var/log/mod_rewrite.log
RewriteLogLevel 6

# redirect to SSL connection
RewriteCond %{REQUEST_URI}  ^/manage/?$
RewriteCond %{SERVER_PORT} 443
# R=301 sends HTTP Moved Permanently L=Last rule for this request
RewriteRule ^(.*)$ https://%{SERVER_NAME}/faces/login [R,L]
</IfModule>

##########################
# MOD PROXY
##########################
# logs
LogFormat "%t - %h - %{BALANCER_WORKER_NAME}e - \"%r\" - %>s - %b" custom
LogLevel warn
CustomLog "/var/log/apache2/custom_balancer.log" custom
ErrorLog  "/var/log/apache2/error_balancer.log"

# proxy
ProxyRequests Off
ProxyPreserveHost On
ProxyVia On
ProxyTimeout 1200

SSLEngine on
SSLProxyEngine On

<Proxy balancer://http_test_cluster>
BalancerMember http://10.0.0.3:7003/faces/login loadfactor=10 retry=120 connectiontimeout=15 timeout=30
BalancerMember http://10.0.0.4:7004/faces/login loadfactor=10 retry=120 connectiontimeout=15 timeout=30
ProxySet lbmethod=byrequests timeout=25
</Proxy>

# balance manager tool has gui
<Location /balancer-manager>
SetHandler balancer-manager
Order deny,allow
Allow from all
</Location>
ProxyPass /balancer-manager !

ProxyPass /faces balancer://http_test_cluster/manage
ProxyPassReverse / http://10.0.0.3:7003/faces/login
ProxyPassReverse / http://10.0.0.4:7004/faces/login

</VirtualHost>

但是,它不起作用。 我反复犯了错误:

(1) pass through /faces/login
(2) init rewrite engine with requested uri /balancer-manager
(3) applying pattern '^(.*)$' to uri '/balancer-manager'
(4) RewriteCond: input='/faces/login' pattern='^/manage/?$' => not-matched

有什么不对? 感谢。

0 个答案:

没有答案