Page 1 of 1

2 web servers with 1 External IP, all ports but 80 blocked?

Posted: 14 Jan 2008, 08:17
by GaryL
Hi guys

At home I have my Bubba, and my Windows Media Center PC.

My Windows PC has a software package called WebGuide. With WebGuide I can schedule TV Recordings over the web.

Bubba's web server currently runs through port 80.
And my WebGuide on my MCE PC through port 8080.

The problem being is with all the places I can access the web. Everywhere seemly blocks all outgoing ports (including 22) except port 80 .

How can I get around this, is there something I can install on Bubba?

A solution that I think I'm after is one where Bubba will fetch what’s displayed on http://mywebsite.com:8080 and display it through http://mywebsite.com:80 where I can access it anywhere.

Gary

Posted: 14 Jan 2008, 08:42
by msx
there should be some options on apache to do that.
i asked it some time ago here.
Anyway i suggest trying a few tricks before going into that. For example at my work there are some other ports opened beside 80.. after some empirical test i discovered that 8080, 443, 8443 are all open. So i managed to do everything splitting my apps on these ports.

Posted: 14 Jan 2008, 09:27
by Ubi
What you seem to want is a reverse proxy:
http://www.google.com/search?q=apache2+ ... tnG=Search

Ubi

Posted: 14 Jan 2008, 12:11
by GaryL
Thanks guys

Sorry for the need of needing to be spoon-fed but this is all new to me.

My bubba is located on a small home network. Workgroup based not domain based.
Will I still be able to use Reverse Proxy?

Sample of my home setup:

Lets say my Media Center PC is named MCPC – ip is 192.168.1.50
MCPC’s webserver can only be reached internally through http://192.168.1.50:8080

And my Bubba is named BUBBA – ip is 192.168.1.100
BUBBA’s webserver can be reached by http://192.168.1.100:80
Or externally through http://mywebsite.dyndns.org:80



Taken from http://www.wlug.org.nz/ApacheReverseProxy
mod_proxy_html

Suppose I want to expose a website that is running on a non-standard port internally. I could use mod_proxy, if the website only used relative or path-only absolute URLS. However, the website happens to know what hostname and port it is supposed to be running on, and has some urls which are targetted directly at the hostname and port. mod_proxy will break in this case, because URLs in the webpages aren't rewritten, and I can't access the device directly from the external network.

mod_proxy_html solves this, by rewriting parts of the source code on the fly. It's implemented as a filter in apache2, which means all webpages in the appropriate block pass through it, and can be rewritten on the fly.

Here is an example config for exposing the CUPS web interface, which runs on port 631, via an ApacheReverseProxy:

First, get the mod_proxy_html module:

Code: Select all

# apt-get install libapache2-mod-proxy-html
You may or may not have to enable the module with

Code: Select all

# a2enmod proxy_html
Then edit the <IfModule mod_proxy.c> section of /etc/apache2/mods-enabled/proxy.conf

Code: Select all

        <IfModule mod_proxy.c>
                ProxyRequests Off
                ProxyPass /cups http://cups.internal.org:631/
                ProxyHTMLURLMap http://cups.internal.org:631/ /cups
                <Location /cups>
                        ProxyPassReverse http://cups.internal.org:631/
                        SetOutputFilter proxy-html
                        ProxyHTMLURLMap /               /cups/
                        ProxyHTMLURLMap /cups/          /cups/
                </Location>
        </IfModule mod_proxy.c>
Then reload the config

Code: Select all

/etc/init.d/apache2 force-reload
New directives that are added include the ProxyHTMLURLMap directive, and the SetOutputFilter directive.

SetOutputFilter tells apache to pass the proxied content through the proxy-html filter, which mod_proxy_html provides. This does all the rewriting discussed below:

The first ProxyHTMLURLMap directive tells mod_proxy_html to rewrite any instance of "http://cups.internal.org:631/" to "/cups". This means any absolute URLs will be rewritten to point under the /cups/ Location, which will then get proxied appropriately.

The remaining ProxyHTMLURLMap directives handle URLs with just a set path, eg "/printers/printer1/". This will get rewritten to "/cups/printers/printer1/" and then proxied correctly. The last directive is a no-rewrite rule, intended to prevent infinite looping.

Posted: 14 Jan 2008, 13:37
by Ubi
Your question is a bit confusing to me. If I understand correctly, you do not have a DNS entry for your box, ,only a windows workgroups entry. This last name is irrelevant when it comes to acces outside your local network. However, you can access the box via its IP adress. Apache has no problem with that, it is in fact its default mode of operation. It looks like this recipe you posted should get your problem fixed.

Ubi

Posted: 14 Jan 2008, 15:02
by GaryL
Would a valid entry in /etc/apache2/mods-enabled/proxy.conf be:

Code: Select all

        <IfModule mod_proxy.c> 
                ProxyRequests Off 
                ProxyPass /webguide http://192.168.1.50:8080/ 
                ProxyHTMLURLMap http://192.168.1.50:8080/ /webguide 
                <Location /webguide> 
                        ProxyPassReverse http://192.168.1.50:8080/ 
                        SetOutputFilter proxy-html 
                        ProxyHTMLURLMap /                   /webguide/ 
                        ProxyHTMLURLMap /webguide/          /webguide/ 
                </Location> 
        </IfModule mod_proxy.c>

Posted: 14 Jan 2008, 15:56
by Ubi
might very well work

try

Code: Select all

apache2ctl -t
to see if there are no errors in the config file.

Posted: 14 Jan 2008, 16:25
by GaryL
ah crap. lol

Image

Image