Koozali.org: home of the SME Server

How do I redirect subdomain.domain.net.nz to domain.net.nz:port?

Offline shell

  • ****
  • 117
  • +0/-0
How do I redirect subdomain.domain.net.nz to domain.net.nz:port?
« on: November 26, 2009, 08:40:57 AM »
Hi,

I need to redirect traffic coming in on one address (which currently resolves to the external IP) to my sme but on a different port. 

This is because corporate it depart externally won't allow their people to access the port in question, they do allow 80 traffic so I'm hoping I can direct subdomain.domain.net.nz:80 traffic to domain.net.nz:1234

I think that proxypass is my best bet, but was looking for direction from the experts :)

I started here:
http://wiki.contribs.org/SME_Server:Documentation:FAQ#Proxy_Pass

and it appears similiar can be done:
http://wiki.contribs.org/Redmine
"
To access Redmine through the main webserver, I created the following custom template in

 mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
 cd /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
 vim 95redmine

  # Redmine proxy to connect to mongrel process on port 2555

  ProxyPass        /redmine http://localhost:2555
  ProxyPassReverse /redmine http://localhost:2555

  <Location /redmine>
    Order Deny,Allow
    Deny from All
    Allow from 127.0.0.1 10.1.0.0/255.255.255.0
  </Location>

Expand the template and restart the http server:

expand-template /etc/httpd/conf/httpd.conf
/etc/rc.d/init.d/httpd-e-smith restart

Now Redmine can be accessed through http://servername/redmine

As you can see from the above, I only allowed access from the local network.
"
Would I do this?

mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
 cd /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
 vim 95port1234

  # Proxy to connect subdomain.domain.net.nz (80) to domain.net.nz:1234

  ProxyPass        /subdomain http://domain.net.nz:1234
  ProxyPassReverse /subdomain http://domain.net.nz:1234

  <Location /redmine>
    Order Deny,Allow
    Deny from All
    Allow from 127.0.0.1 10.1.0.0/255.255.255.0 ???
  </Location>

and expand?

Or is there a different way to do this?

Cheers in advance for any suggestions or wisdom,
Shell

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: How do I redirect subdomain.domain.net.nz to domain.net.nz:port?
« Reply #1 on: November 27, 2009, 08:01:11 AM »
Add subdomain.domain.net.nz via server-manager. Then modify the (sub)domain via:

Code: [Select]
db domains setprop subdomain.domain.net.nz TemplatePath ProxyPassVirtualHosts
db domains setprop subdomain.domain.net.nz ProxyPassTarget http://domain.net.nz:1234/
expand-template /etc/httpd/conf/httpd.conf
sv 1 /service/httpd-e-smith