Php – How to Proxypass on Apache

apache-2.2httpd.confPHPPROXY

I googled and i couldnt come across anything that is directive on configuring apache for proxypass.

I did managed to find Transition domain to new web host without waiting for DNS propagation but i dont understand what they're talking about, especially the following:

1) how could I enable the proxy, proxy_http and the rewrite modules

2) where to find apache config file and this line?

RewriteEngine on 
ProxyPassReverse   /      http://<your-fqdn-here>/
ProxyPass          /      http://<your-fqdn-here>/

I mean can you guide me through configuring ProxyPass?

Update

Im running on centOS Apache version:

Server version: Apache/2.2.22 (Unix)
Server built:   Feb 10 2012 16:45:29
Cpanel::Easy::Apache v3.9.1 rev9999

I tried to install the proxy modules by follwing this tutorial http://www.hackersgarage.com/install-mod_proxy-apache-module-on-whmcpanel-ceentos-linux-server.html

But i got this error:

./configure --enable-mods-shared="proxy proxy_http proxy_connect"
-bash: ./configure: /bin/sh: bad interpreter: Permission denied

So i just ignored it and continued with the rest of the commands. When I tried to restart apache:

root@db [/tmp/httpd-2.2.22]# /etc/init.d/httpd restart  
httpd: Syntax error on line 36 of /usr/local/apache/conf/httpd.conf: module proxy_module is built-in and can't be loaded

Just added this to httpd.conf and it worked

< VirtualHost *:80 >
   ServerName domain.com
ServerAlias www.domain.com

< IfModule mod_proxy.c >
ProxyPass / http://www.newdomain.com/
ProxyPassReverse / http://www.newdomain.com/
< / IfModule >
< / VirtualHost >

Best Answer

Take a look at this:

http://library.linode.com/web-servers/apache/proxy-configuration/multiple-webservers-proxypass-centos-5

It's for CentOS5, but CentOS6 will have similar configuration, as Apache hasn't changed significantly.

Basically, you should not be trying to compile mod_proxy. CentOS's httpd server already has that as a compiled-in module. You just have to activate the proxy directives using the above document. So, you should back out whatever changes you've made when you compiled the module.