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 can't figure out how to use mod_proxy on my server. I did the configuration as follows in httpd.conf:

<VirtualHost *:80>
    ServerAdmin support@mysite.com
    ServerName mysite.com
    ServerAlias www.mysite.com
    DocumentRoot /var/lib/tomcat/webapps/

<Proxy *>
  AddDefaultCharset Off
  Order deny,allow
  Allow from all
</Proxy>
</VirtualHost>

<VirtualHost *:80>
   ProxyPreserveHost On
   ProxyPass / http://mysite.com:8080/
   ProxyPassReverse / http://mysite.com:8080/
   ServerName www.mysite.com
</VirtualHost>

What is happening?

share|improve this question
    
Your syntax is completely wrong for your config file, so its difficult to see what's really going on. Additionally, you haven't specified what's wrong--how does it not work? –  Andrew M. Mar 13 '12 at 3:20
    
When I access the www.mysite.com, appears the archives that are on DocumentRoot /var/lib/tomcat/webapps/ –  Gustavo Mar 13 '12 at 3:22
    
As written, your httpd.conf is invalid; please update with the correct file (making sure to use ServerFault's code syntax). –  Andrew M. Mar 13 '12 at 3:24
    
You can explain it? I do not understand ... –  Gustavo Mar 13 '12 at 3:28

1 Answer 1

Example of how to properly proxy with Apache:

#you need these:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so

#main config
<VirtualHost *:80>
    ServerName dev.ionfish.org
    ProxyRequests     Off
    ProxyPreserveHost On
  <Proxy *>
    Order deny,allow
    Allow from all
  </Proxy>
    ProxyPass / http://other.site.com:80/
    ProxyPassReverse / http://other.site.com:80/
  <Location />
    Allow from all
  </Location>
</VirtualHost>
share|improve this answer
    
After the change, appears the following error: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. –  Gustavo Mar 13 '12 at 3:44
    
See my revisions above, make sure you call the modules properly. –  ionFish Mar 13 '12 at 3:55
    
apache2: Syntax error on line 208 of /etc/apache2/apache2.conf: Syntax error on line 3 of /etc/apache2/httpd.conf: Cannot load /etc/apache2/modules/mod_proxy_balancer.so into server: /etc/apache2/modules/mod_proxy_balancer.so: cannot open shared object file: No such file or directory –  Gustavo Mar 13 '12 at 4:01
    
Of course you would make sure you use the correct syntax for your server, instead of /modules/ you use "mods-enabled" like "a2enmod xyz" edit: if that still doesn't help, refer here: boriskuzmanovic.wordpress.com/2006/10/20/… It is most similar to what type of setup you seem to have. Here too: abhirama.wordpress.com/2008/11/03/apache-mod_proxy-in-ubuntu –  ionFish Mar 13 '12 at 4:03

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.