Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 >

share|improve this question
1  
What specifically is it from the other answer that you don't understand? :-) –  Mathias R. Jessen Mar 10 '12 at 21:44
    
how could I enable the proxy, proxy_http and the rewrite modules? –  kornesh Mar 10 '12 at 21:58
add comment

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer
    
it worked thanks alot! –  kornesh Mar 11 '12 at 0:08
add comment

I'll try to address your questions as best I can, with the information you've provided.

First, with regard to enabling modules this will vary by distribution. On RHEL/CentOS, for example, the rewrite and proxy modules are included with the base httpd package, you shouldn't need to do anything else.

On Debian, by contrast, you need to symlink the configuration file from mods-available to mods-enabled. There is a tool called a2enmod to help with this, for example:

a2enmod proxy
a2enmod rewrite

You should take a look at what modules can be enabled by looking at the config files in /etc/apache2/mods-available/, if you are using Debian. I believe Ubuntu Server is exactly the same.

As far as number 2 is concerned, you can put the proxy configuration in a <VirtualHost> declaration that you'd like to proxy. This can, again, vary by distribution or preference. Most RHEL/CentOS systems will encourage the use of a site-specific my-website.com.conf file in /etc/httpd/conf.d/. Debian users should put the file in /etc/apache2/sites-enabled/ (or in sites-available, and create a symlink with a2ensite). A full guide on these helper tools can be found here.

share|improve this answer
    
im running CentOS and tried to enable the modubles on httpd.conf but it failed to load when i tried to restart the server. I've updated the question with th errors i faced. –  kornesh Mar 10 '12 at 22:49
    
Thank you for helping me out :) –  kornesh Mar 11 '12 at 0:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.