Question: My home setup is as follows:

Internet -> pfsense router -> Multiple Windows 7 machines
 Ubuntu NAS w/Webmin

I have dynamic DNS setup so I have www.domainname.com updating with the pfsense WAN box

For example having the java VNC web-server on 2 of the windows 7 machines, I can have it setup so that, for example:

www.domain.com:5800 is PC1
www.domain.com:5901 is PC2

What I want to know is if it is possible to install apache on the ubuntu box, forward port 80 traffic to it, and set it up to have eg

www.domain.com/PC1 redirect to PC1 java vnc server on default port
www.domain.com/PC2 redirect to PC2 vnc etc..

If it is possible, some pointers would be appreciated.

Answer: 
try apache rewrite engine. something like:

```
<VirtualHost ubuntu:80>
    ServerName domainname.com
    RewriteCond %{REQUEST_URI}      ^/PC1
    RewriteRule ^/(.*)$             http://pc1:5800/$1 [R=permanent,L]
    RewriteCond %{REQUEST_URI}      ^/PC2
    RewriteRule ^/(.*)$             http://pc1:5901/$1 [R=permanent,L]
</VirtualHost>

```

update. i just realised that you might as well have these two PCs not available from the internet, ie behind the router with no external IPs. in that case you have to modify the above, so it redirects requests to the same ubuntu machine on different ports and then does a proxy pass to local windows servers:

```
<VirtualHost ubuntu:80>
    ServerName domainname.com
    RewriteCond %{REQUEST_URI}      ^/PC1
    RewriteRule ^/(.*)$             http://ubuntu:5800/$1 [R=permanent,L]
    RewriteCond %{REQUEST_URI}      ^/PC2
    RewriteRule ^/(.*)$             http://ubuntu:5901/$1 [R=permanent,L]
</VirtualHost>

<VirtualHost ubuntu:5800>
    ServerName domainname.com
    ProxyPass / http://pc1:5800/
    ProxyPassReverse / http://pc1:5800/
</VirtualHost>

<VirtualHost ubuntu:5901>
    ServerName domainname.com
    ProxyPass / http://pc2:5901/
    ProxyPassReverse / http://pc2:5901/
</VirtualHost>

```

uff... hope this helps... :)
Try this:

```
<VirtualHost ubuntu:80>
  ServerName domainname.com
  ProxyPass /PC1 http://pc1:5901/
  ProxyPassReverse /PC1 http://pc1:5901/
  ProxyPass /PC2 http://pc2:5901/
  ProxyPassReverse /PC2 http://pc2:5901/
</VirtualHost>

```

Much easier than messing with `RewriteRule`