Forum Moderators: phranque
First of all, nice forum =)
Lets go, my scenario is:
Apache:
2 Dns names:
www.domain.com
fv.domain.com
When i access www.domain.com, i need open a static page, in my /var/www/html folder (root or home folder) and its ok, working fine.
But when i access fv.domain.com, i want a redirect for a jboss instance, like:
fv.domain.com:8080/fv/
I using this following Virtual Directory:
<VirtualHost fv.domain.com:80>
servername fv.domain.com.br
RewriteEngine on
RewriteLogLevel 9
ServerSignature on
RewriteCond %{SERVER_PORT} !^8080$
RewriteRule ^/(.*) http://fv.domain.com:8080/fv/$1 [P,NC,L,R]
RewriteLog “/etc/httpd/logs/fv_redirect.log”
CustomLog /etc/httpd/logs/fv_access.log combined
ErrorLog //etc/httpd/logs/fv_error.log
</VirtualHost>
but nothing happen.
The log is created but nothing appear on logs.
When i access fv.domain.com, apache redirect me to www.domain.com
Apache 2.3
Can anyone help me? =/
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
Anyone have an idea about this problem? =/
ProxyPass / http://fv.example.com:8080/fv/
ProxyPassReverse / http://fv.example.com:8080/fv/
[edited by: jdMorgan at 12:54 am (utc) on Jan. 9, 2009]
[edit reason] Repaired formatting, de-linked. [/edit]
I trying a new condition, cause i see mine don't mach.
<VirtualHost 192.168.0.1:80>
servername fv.domain.com
RewriteEngine on
RewriteLogLevel 9
ServerSignature on
RewriteCond %{REQUEST_URI} ^/fv/.+
RewriteRule ^/(.*) [fv.domain.com:8080...] [P,NC,L,R]
RewriteLog /etc/httpd/logs/fv_redirect.log
CustomLog /etc/httpd/logs/fv_access.log combined
ErrorLog /etc/httpd/logs/fv_error.logi
</VirtualHost>
But i think it don't mach too, cause i cannot access fv as uri, and as url, fv.domain.com
If i use proxy, the browser will change the address, and my jboss app was made to run in / of the webserver
So i need when people access fv.domain.com, was redirected to fv.domain.com:8080/fv/, but in the browser the address still fv.domain.com.
When people access www.domain.com, still workin the directory that i have today (/var/www/html/).
Any idea?
If i use proxy, the browser will change the address
So i need when people access fv.domain.com, was redirected to fv.domain.com:8080/fv/, but in the browser the address still fv.domain.com.
LogLevel debug, mod_proxy will log some useful information. I just have 1 ip to server.
NameVirtualHost *:80
#
<VirtualHost *:80>
servername www.domain.com
DocumentRoot /var/www/html
CustomLog /etc/httpd/logs/access.log combined
ErrorLog /etc/httpd/logs/error.logi
</VirtualHost>
#
<VirtualHost *:80>
servername fv.domain.com
ProxyPass / http://fv.example.com:8080/fv/
ProxyPassReverse / http://fv.example.com:8080/fv/
ProxyPassReverseCookieDomain fv.example.com:8080 fv.domain.com
ProxyPassReverseCookiePath /fv/ /
CustomLog /etc/httpd/logs/fv_access.log combined
ErrorLog /etc/httpd/logs/fv_error.logi
</VirtualHost> Don't forget to restart apache. If there's still a redirect (HTTP 30x status code to the browser), investigate what causes this. It's not the directive ProxyPass.
BTW - [P,NC,L,R] - this cannot issue a redirect because the check for proxying comes always first.