Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 9322
  • Last Modified:

setting up proxy on apache

I am trying to my Apache webserver forward incoming requests from the www to another internal web server on a different port.

For example, I want the www user to be able to type:
http://www.domain.com:7000
and have apache route this request for "/" to another internal webserver:
http://192.168.0.2:8000

and if the user types:
http://www.domain.com:7000/test.html
apache would route the request to:
http://192.168.0.2:8000/test.html

I have alot of port-based virtual hosts set up, so I am trying to do all this by adding it all within another virtual host.  Here is what I have:

<VirtualHost *:7000>
ServerName www.mydomain.com
ProxyRequests Off
ProxyPass / http://192.168.0.2:8000
ProxyPassReverse / http://192.168.0.2:8000
</VirtualHost>


This doesn't work though, all I get is a "you're not authorized to view this page" error.

Any help would be appreciated, thanks!

0
rustycp
Asked:
rustycp
1 Solution
 
caterham_wwwCommented:
Which server generates this message? (What can you find in the logs?)

Let's make sure, the virtualhost works without ProxyPass.
Add a DocumentRoot directive and check if you can see the site.
0
 
rustycpAuthor Commented:
when I hit the server I get this in the apache log:

xxxxxxx.nc.rr.com - - [15/Apr/2005:15:15:13 -0400] "GET / HTTP/1.1" 403 202 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"

and nothing in the internal web server's log...




0
 
rustycpAuthor Commented:
Ok, I also did the test, and I changed this virtual host to this:

<VirtualHost *:7000>
ServerName www.mydomain.com
DocumentRoot /var/www/default
</VirtualHost>

and I can see the /var/www/default/index.html page correctly
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
rustycpAuthor Commented:
and I also checked that on my apache server I can type:

links http://192.168.0.2:8000

and browse the other internal web server just fine...

0
 
arjecahnCommented:
What you did previously was ok.
What happens when you add a / behind the URL's?
Like this:

<VirtualHost *:7000>
ServerName www.mydomain.com
ProxyPass / http://192.168.0.2:8000/
ProxyPassReverse / http://192.168.0.2:8000/
</VirtualHost>

0
 
rustycpAuthor Commented:
I get the same results exactly when I do the trailing slashes...  here is my entire httpd.conf:


### Section 1: Global Environment ######################################
ServerTokens OS
ServerRoot "/etc/httpd"
ScoreBoardFile "/var/run/httpd.scoreboard"
PidFile "/var/run/httpd.pid"
TimeOut 300
KeepAlive false
MaxKeepAliveRequests 100
KeepAliveTimeout 15
<IfModule prefork.c>
        StartServers 8
        MinSpareServers 5
        MaxSpareServers 20
        MaxClients 150
        MaxRequestsPerChild 100
</IfModule>
<IfModule worker.c>
        StartServers         2
        MaxClients         150
        MinSpareThreads     25
        MaxSpareThreads     75
        ThreadsPerChild     25
        MaxRequestsPerChild  0
</IfModule>
<IfModule perchild.c>
        NumServers           5
        StartThreads         5
        MinSpareThreads      5
        MaxSpareThreads     10
        MaxThreadsPerChild  20
        MaxRequestsPerChild  0
</IfModule>

Listen 80
Listen 7000
Listen 7476
Include conf.d/*.conf

LoadModule access_module modules/mod_access.so
LoadModule auth_module modules/mod_auth.so
LoadModule auth_anon_module modules/mod_auth_anon.so
LoadModule auth_dbm_module modules/mod_auth_dbm.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule include_module modules/mod_include.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imap_module modules/mod_imap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so

LoadModule proxy_module modules/mod_proxy.so

User apache
Group apache
ServerAdmin test@mydomain.com
ServerName localhost
UseCanonicalName on
DocumentRoot /var/www/default/www
HostNameLookups On
DirectoryIndex index.html index.htm index.shtml
AccessFileName .htaccess
ServerSignature Off

# Disable autoindex
<LocationMatch "/$">
    Options -Indexes
</LocationMatch>

# The following lines prevent .htaccess and .htpasswd files from being viewed by Web clients.
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>

TypesConfig "/etc/mime.types"
DefaultType text/plain
AddType application/x-tar .tgz
<IfModule mod_mime_magic.c>
    MIMEMagicFile conf/magic
</IfModule>
AddEncoding x-compress Z
AddEncoding x-gzip gz tgz
AddDefaultCharset ISO-8859-1


AddOutputFilter INCLUDES .shtml
AddOutputFilter INCLUDES .html

ErrorLog /var/log/httpd/error_log
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
TransferLog /dev/null

<IfModule mod_dav_fs.c>
    # Location of the WebDAV lock database.
    DAVLockDB /var/lib/dav/lockdb
</IfModule>

# The following directives fix known problems with various browsers
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully


### Section 3: Virtual Hosts #################################
LockFile "/var/lock/httpd.lock"
CoreDumpDirectory "/etc/httpd"
NameVirtualHost *:80
NameVirtualHost *:7000
NameVirtualHost *:7476


<VirtualHost *:80>
ServerName www.mydomain2.com
<LocationMatch "^/authorized/.*">
        AuthType Basic
        AuthName "Password Required"
        AuthUserFile /var/www/passwd
        require valid-user
</LocationMatch>
ScriptAlias /cgi/ /var/www/default/cgi/
CustomLog /var/log/httpd/mydomain2/access_log combined
ErrorLog /var/log/httpd/error_log
</VirtualHost>

<VirtualHost *:80>
ServerName www.mydomain.com
ServerAlias mydomain.com
DocumentRoot /var/www/mydomain/www
ScriptAlias /cgi-bin/  /var/www/mydomain/cgi/
ErrorDocument 404 http://www.mydomain.com
ErrorDocument 500 http://www.mydomain.com
CustomLog /var/log/httpd/mydomain/access_log combined
ErrorLog /var/log/httpd/error_log
</VirtualHost>

<VirtualHost *:80>
ServerName www.mydomain3.com
ServerAlias mydomain3.com
DocumentRoot /var/www/mydomain3/www
ScriptAlias /cgi-bin/  /var/www/mydomain3/cgi/
ErrorDocument 404 http://www.mydomain3.com
ErrorDocument 500 http://www.mydomain3.com
CustomLog /var/log/httpd/mydomain3/access_log combined
ErrorLog /var/log/httpd/error_log
</VirtualHost>


<VirtualHost *:80>
ServerName www.mydomain4.com
ServerAlias mydomain4.com
DocumentRoot /var/www/mydomain4/www
ScriptAlias /cgi/ /var/www/mydomain4/cgi/
ErrorDocument 404 http://www.mydomain4.com
ErrorDocument 500 http://www.mydomain4.com
ServerAdmin me@mydomain4.com
CustomLog /var/log/httpd/mydomain4/access_log combined
ErrorLog /var/log/httpd/error_log
</VirtualHost>


<VirtualHost *:80>
ServerName www.mydomain5.com
ServerAlias mydomain5.com
DocumentRoot /var/www/mydomain5/www
ScriptAlias /cgi/ /var/www/mydomain5/cgi/
ErrorDocument 404 http://www.mydomain5.com
ErrorDocument 500 http://www.mydomain5.com
ServerAdmin me@mydomain5.com
CustomLog /var/log/httpd/mydomain5/access_log combined
ErrorLog /var/log/httpd/error_log
</VirtualHost>

<VirtualHost *:7000>
ServerName www.mydomain.com
ProxyPass / http://192.168.0.2:8000/
ProxyPassReverse / http://192.168.0.2:8000/
CustomLog /var/log/httpd/test_log combined
#DocumentRoot /usr/bin/summary/www
</VirtualHost>

<VirtualHost *:7476>
ServerName PHPMyAdmin
DocumentRoot /usr/bin/phpmyadmin/phpMyAdmin-2.6.1-pl3
DirectoryIndex index.php
</VirtualHost>

0
 
arjecahnCommented:
Not really sure, but what happens if you put UseCanonicalName to 'off'?
Is www.mydomain5.com working normally?

0
 
rustycpAuthor Commented:
I get the same results with UseCanonicalName off.. Also domain5 seems to be working fine... I even just tried using webmin gui to configure it for me, and still get the same result.

I am so stumped, it's probably something obvious, ug.
0
 
arjecahnCommented:
what's inside the .conf files that you mount in?
0
 
rustycpAuthor Commented:
the other conf files are:

perl.conf
php.conf
python.conf
squirrelmail.conf

which contain:

LoadModule perl_module modules/mod_perl.so

LoadModule php4_module modules/libphp4.so
AddType application/x-httpd-php .php

LoadModule python_module modules/mod_python.so

 and

Alias /webmail /usr/share/squirrelmail

0
 
rustycpAuthor Commented:
I am noticing these errors in my error_log:

[Tue Apr 19 12:51:17 2005] [warn] proxy: No protocol handler was valid for the URL /. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.
[Tue Apr 19 12:51:47 2005] [warn] proxy: No protocol handler was valid for the URL /. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.
[Tue Apr 19 12:51:47 2005] [warn] proxy: No protocol handler was valid for the URL /favicon.ico. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.
[Tue Apr 19 12:51:52 2005] [warn] proxy: No protocol handler was valid for the URL /index.html. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.


Does this help me figure out what to do?

0
 
rustycpAuthor Commented:
I figured it out, I need this in my httpd.conf file:


LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so


0
 
PAQ_ManCommented:
Question Closed, 250 points refunded.
PAQ_Man
Community Support Moderator
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now