I am trying to install Mod_Proxy Apache module on WHM/CPanel CeEntOS Linux Server. Here is system info:
CentOS release 5.6 (Final)
Server version: Apache/2.2.21 (Unix)
Cpanel::Easy::Apache v3.7.2 rev9999
The purpose of me installing is so that when on site abc.com, when I click a link to site auto.efg.com (lets pretend its ip address is 192.168.0.101), the browser will load the application on auto.efg.com while mainitaing abc.com on address bar of browser.
So I followed this tutorial:
http://www.hackersgarage.com/install-mod_proxy-apache-module-on-whmcpanel-ceentos-linux-server.html
And so when I finished following it, I was able to do this:
root@ip-xxx-xxx-xxx [/tmp/httpd-2.2.21/modules/proxy]# ls -l
/usr/local/apache/modules/mod_proxy*
-rwxr-xr-x 1 root root 88708 Jan 5 08:22 /usr/local/apache/modules/mod_proxy.so*
-rwxr-xr-x 1 root root 49654 Jan 5 08:23 /usr/local/apache/modules/mod_proxy_connect.so*
-rwxr-xr-x 1 root root 73196 Jan 5 08:23 /usr/local/apache/modules/mod_proxy_http.so*
Now after I followed those instructions and tried to restart the server, I got the following error:
/etc/init.d/httpd restart
httpd: Syntax error on line 35 of /usr/local/apache/conf/httpd.conf: module proxy_module is built-in and can't be loaded
You see, that occured because I had loaded the module for proxy_module,. proxy_http_module in httpd.conf, so I commented them out in /usr/local/apache/conf/httpd.conf:
# LoadModule proxy_module modules/mod_proxy.so
# LoadModule proxy_http_module modules/mod_proxy_http.so
# LoadModule proxy_connect_module modules/mod_proxy_connect.so
Now that error went away.
And my virtual host setting looks like this:
<VirtualHost 50.63.53.79:80>
ServerName abc.com
ServerAlias www.abc.com
DocumentRoot /home/eagl0028/public_html
ServerAdmin [email protected]
## User eagl0028 # Needed for Cpanel::ApacheConf
<IfModule mod_suphp.c>
suPHP_UserGroup eagl0028 eagl0028
</IfModule>
<IfModule !mod_disable_suexec.c>
SuexecUserGroup eagl0028 eagl0028
</IfModule>
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPreserveHost On
ProxyPass / http://192.168.0.101/
ProxyPassReverse / http://192.168.0.101/
CustomLog /usr/local/apache/domlogs/abc.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
CustomLog /usr/local/apache/domlogs/abc.com combined
ScriptAlias /cgi-bin/ /home/eagl0028/public_html/cgi-bin/
</VirtualHost>
However, when I run:
service httpd stop
service httpd start
And then post to a relative url:
<form accept-charset="UTF-8" action="/users/sign_in" class="user_new" id="user_new" method="post">
Im expecting it to post to 192.168.0.101 but it doesnt. I check the 192.168.0.101 server logs and no sign of a request coming in. All that occurs is a 404 not found error with the url on top being abc.com/users/sign_in
Your VirtualHost has an IP address+port pair of 50.63.53.79:80. This may sound like obvious advice, but if the server has multiple IP addresses or ports that it's listening on, make sure that your browser is in fact hitting that IP address and port. If the POST is hitting port 443 or similar, this virtualhost will not be the one that gets used. This would explain why nothing shows up in the log. Check the main server log, to see if your request went there. If you're running your test from the local network and it's hitting a local network IP address, that would definitely do it.
Similar behavior can be triggered if you have this configuration in an include file that is not actually being used.
In both cases, running the httpd binary by hand with the
-S
parameter (make sure you're including all of the necessary parameters from the currently running apache process that you see in the process table) will show you all of the defined virtual hosts and help you spot ones that are missing, or other address+port pairs that might be catching the traffic.You can configure a virtualhost to listen to all IP addresses by using a * instead of the IP address.
You can also explicitly configure multiple IP Addresses
The
href
ofhttp://auto.efg.com/users/sign_in/
is sending your browser away from the proxy - it's not Apache's job to make sure that every link on the page keeps your browser talking to the proxy. (There are some third party modules that alter the URLs on the page in transit, but they won't work against anything except links in flat HTML)Can you alter the link to leave the scheme and host intact?