# Forward incoming connection on port 80

## fedex

Hi all

To be honest, I haven't spent too much time searching on the forum a similar post, debating the same problem I have, and I haven't did this because I was lazy but because I didn't even knew what to search for. I would not be upset if you will critisize me as long as you can provide me a little help too no matter if it is only a suggestion of what to look for.

Now, regarding my problem, I have a machine with gentoo installed on it. I use this machine as a router, an web server, a database server, and so on. On one network interface, I obviously have an external routable fix IP address, on the other one an internal IP address with the pattern 192.168.1.0 /24. In this network, I have a computer with Windows 2K8 installed on it and with SharePoint running on the IP address of this computer. How can I do so that I can get to this computer from the outside of it's network using the address of the router plus a name. 

For example:

 *Quote:*   

> http://routable-ip-address/SharePoint

 

For the above example all the requests will go to:

 *Quote:*   

> http://192.168.1.100/

 

Thank you in advance for any advice!

----------

## magic919

Ok.  Can't see you achieving exactly that but take a look at forwarding ports using iptables.  You could hit your external IP and say port 81 and have that redirect to the 192.186.1.x Windows boxen.

http://fclose.com/b/816/port-forwarding-using-iptables/

----------

## madchaz

you can't do it directly like that. 

What you want to do is redirect trafic from the sharepoint port toward the machine inside your network. 

So say you wanted people to connect using something like http://routable-ip:sharepointport

When people connect to it, they would get sent to the sharepoint server inside your network. 

Then, you can setup a page on the webserver on your gentoo box at http://routable-ip/sharepoint that redirects to the above URL (using html redirect)

that would get you the result you are looking for. 

Note that if sharepoint uses port 80, you will need to re-configure it to use a different port, otherwise when you connect externally to it, you will end up back to your webserver on the gentoo box.

----------

## malern

I don't know what SharePoint is, but if it acts as a normal webserver I imagine you could do what you want with mod_proxy (assuming you're using apache on your gentoo machine). You'd need to enable mod_proxy in your /etc/conf.d/apache2 file and add these apache directives to your httpd config

```
ProxyPass /SharePoint http://192.168.1.100

ProxyPassReverse /SharePoint http://192.168.1.100
```

That will make your gentoo machine forward any requests for the /SharePoint url to the 192.168.1.100 machine.Last edited by malern on Thu Dec 09, 2010 4:00 pm; edited 1 time in total

----------

## fedex

Hi 

Thank you for all your answers. I have adopted malern's method.

Malern, I will explain you what I have done before telling you the errors.

I have installed mod_proxy using the command:

```
emerge --av mod_proxy_html
```

I have added the following lines into /etc/apache/httpd.conf:

```
<IfDefine PROXY_HTML>

LoadModule mod_proxy_module modules/mod_proxy_html.so

</IfDefine>
```

Then I have added the the option

```
-D PROXY
```

into /etc/conf.d/apache and the lines:

```
ProxyPass /SharePoint http://192.168.1.100

ProxyPassReverse /SharePoint http://192.168.1.100
```

into the same file (/etc/conf.d/apache)

Upon restarting apache I have received the following errors:

```
/etc/conf.d/apache2: line 75: ProxyPass: command not found

/etc/conf.d/apache2: line 76: ProxyPassReverse: command not found
```

Do you have any idea where is my mistake?

Thank you in advance

----------

## molot

Err why did you use mod_proxy_html module, but mod_proxy configuration keywords?

And have you read http://httpd.apache.org/docs/2.3/mod/mod_proxy.html? It seems you need just mod_proxy for basic redirect, and you need it loaded for mod_proxy_html to work. Apache does not log errors loading them?

----------

## fedex

@molot: I don't think I have fully understand what you tried to tell me. I really don't know how to declare a LoadModule directive but I thought that's the right way to do it. The name mod_proxy_html camed from the module that I have installed, if you look into my post I explain all the steps I have made. The reason why I installed mod_proxy_html is because that was the only package available and I couldn't find any flag for apache that I could use in order to reinstall it using mod_proxy. If what I done is wrong, can someone please tell me what should I do it?

Thank you in advance!

----------

## magic919

Have a look here for Apache flags - http://www.gentoo.org/proj/en/apache/doc/upgrading.xml

Stick them in make.conf as usual.

----------

## Hu

Sharepoint is a Microsoft Windows-based document repository.  It is meant to get around the limitation that most Microsoft Office documents do not interact well with basic version control systems.

----------

## fedex

@magic919: that was very helpful, thank you very much.

Any other ideas?

Thank you in advance!

----------

## malern

 *fedex wrote:*   

> I have installed mod_proxy using the command:
> 
> ```
> emerge --av mod_proxy_html
> ```
> ...

 

mod_proxy isn't the same as mod_proxy_html. To get mod_proxy you need to add it to your APACHE2_MODULES var in make.conf. So something like

```
APACHE2_MODULES="mod_proxy mod_proxy_http"
```

and then remerge apache. (note: this is off the top of my head, I can't test it atm)

 *fedex wrote:*   

> I have added the following lines into /etc/apache/httpd.conf:
> 
> ```
> <IfDefine PROXY_HTML>
> 
> ...

 

You shouldn't need to edit the httpd.conf file like that, the ebuild should take care of it

 *fedex wrote:*   

> Then I have added the the option
> 
> ```
> -D PROXY
> ```
> ...

 

I assume you mean /etc/conf.d/apache2, and that you added it to the APACHE2_OPTS var? If so, that's correct.

 *fedex wrote:*   

> and the lines:
> 
> ```
> ProxyPass /SharePoint http://192.168.1.100
> 
> ...

 

Those are apache config directives, so they need to be added to your apache config file (httpd.conf or one of your vhost config files), not /etc/conf.d/apache2

Then restart apache.

----------

