2

here's my system:

CentOS release 5.6 (Final)
Server version: Apache/2.2.21 (Unix)
Cpanel::Easy::Apache v3.7.2 rev9999

I am trying to create a reverse proxy to load files from another server onto my server, as I explained here a while ago:

use a domain on one server to load an application on another server

However, at the time I wrote that I was thinking I would be using ubuntu but now found out it will be centos. I was going to follow this article:

http://jeffbaier.com/articles/configuring-apache-virtual-hosts-for-nat/

But on this specific line:

"We need to make sure mod_proxy and mod_proxy_http are loaded. If the proxy modules are loaded, you’ll see them listed. If nothing is found, this means you need to create symbolic links from the mods-available folder to the mods-enabled folder."

It explains how to check if those two modules are loaded and if not, how to create symbolic links to load them. However, it explains how to do it on ubuntu.

If I even try to attempt to do that on centos:

cd /etc/apache2/
-bash: cd: /etc/apache2/: No such file or directory

there is no apache2 folder in etc.

So I am trying to figure out how to do it on centos.

thanks for response

1
  • 1
    Normaly under CentOS you use httpd so the Folder is /etc/httpd/ Jan 4, 2012 at 16:28

3 Answers 3

8

In /etc/httpd/conf/httpd.conf make sure you have the following lines enabled (no # infront of them):

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

This link will probably be useful for you to read too:
http://www.linuxtopia.org/online_books/centos5/centos5_administration_guide/centos5_ch-httpd.html

Worth noting is that CentOS is an openly built version of the RedHat operating system, so any documentation you can find for RedHat 5 would almost always fully apply to CentOS aswell. CentOS 6 is released, btw, so you might also want to think of upgrading!

For Virtualhost configuration; put this in the end of httpd.conf:

NameVirtualHost *:80

<VirtualHost *:80>
  ServerName domain2.com
  DocumentRoot /var/www
  ProxyRequests Off
  Order deny,allow
  Allow from all

  ProxyPass / http://192.168.1.120:8080/
  ProxyPassReverse / http://192.168.1.120:8080/
</VirtualHost>

And see how it works. You'll ofcourse have to change domain2.com for your own domain and 192.168.1.120 for whatever your own infrastructure uses as IP adresses.

7
  • thanks for response. Do I also need to include these lines: NameVirtualHost * ServerName domain2.com DocumentRoot /var/www/ ProxyRequests Off Order deny,allow Allow from all ProxyPass / 192.168.1.120:8080 ProxyPassReverse / 192.168.1.120:8080 Jan 4, 2012 at 16:42
  • See updates above on VirtualHost, I hope that would do the trick for you. Jan 4, 2012 at 17:27
  • thanks for response, when i tried to restart server, i got this: /etc/httpd/conf/httpd.conf: Cannot load /etc/httpd/modules/mod_proxy.so into server: /etc/httpd/modules/mod_proxy.so: cannot open shared object file: No such file or directory Jan 4, 2012 at 17:50
  • I am not sure if Cpanel modifies modules or module paths, but in my system I have a link from /etc/httpd/modules pointing to /usr/lib64/httpd/modules and in there I find my mod_proxy.so properly, its listed as being installed with my httpd package. If cpanel changes this behavior I am not sure I can help you further. :/ Jan 4, 2012 at 18:14
  • hey thanks for response, I called the host and they said I need to rebuild apache and select the proxy option. But your advice has been helpful. Jan 5, 2012 at 14:13
2

Under centos, you will not find the path /etc/apache2. You can will find /etc/httpd.

0

RHEL/CentOS - webSocket to use requires Apache 2.4x (not Apache 2.2)

LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so

And then:

ProxyPass / ws://192.168.1.120:8080/
ProxyPassReverse / ws://192.168.1.120:8080/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .