Koozali.org: home of the SME Server

Forwarding traffic for virtual domain. Help, Please.

solo

Forwarding traffic for virtual domain. Help, Please.
« on: August 05, 2007, 03:46:58 AM »
I have been running sme server for a few weeks now. I've already had a linux/apache server up but wanted to implement more security, simplify virtual domains, and add more features to my network.

I cannot get the sme server to use my linux/apache server for one of my domains. Under "Hostnames and Addresses" I configure the www."domain".com to point to my local machine, and on my local network the website works fine. However, when others try to access the site externally they get the default "This website is under construction" message.

I know very little about DNS and am at my wits end.

Thanks,
Solo

Offline crazybob

  • *****
  • 894
  • +0/-0
    • Stalzer R&D
Forwarding traffic for virtual domain. Help, Please.
« Reply #1 on: August 05, 2007, 04:15:00 AM »
I believe you will need a contrib named "proxypass". Do a search in the SME 7.X contribs area.
If you think you know whats going on, you obviously have no idea whats going on!

solo

Forwarding traffic for virtual domain. Help, Please.
« Reply #2 on: August 05, 2007, 06:42:47 AM »
Thank you I think your spot on; however, I installed proxypass and it still won't work.

I do think a type of "reverse proxy" will work. Now I just need to figure out an effective way of implementing one.

Frankly, I don't know which apache configuration file to edit.

Offline pfloor

  • *****
  • 889
  • +1/-0
Forwarding traffic for virtual domain. Help, Please.
« Reply #3 on: August 05, 2007, 06:45:05 AM »
ProxyPass is now built into SME7

Code: [Select]
db domains setprop www."domain".com TemplatePath ProxyPassVirtualHosts ProxyPassTarget http://IP.Address.of.internal.server/path_if_needed/

expand-template /etc/httpd/conf/httpd.conf

/etc/init.d/httpd-e-smith restart
In life, you must either "Push, Pull or Get out of the way!"

Offline pfloor

  • *****
  • 889
  • +1/-0
Forwarding traffic for virtual domain. Help, Please.
« Reply #4 on: August 05, 2007, 06:49:14 AM »
Also, if you have www."domain".com set up as a virtual domain, remove it.  You want SME to pass requests directly to the internal server.
In life, you must either "Push, Pull or Get out of the way!"

solo

Forwarding traffic for virtual domain. Help, Please.
« Reply #5 on: August 05, 2007, 07:14:28 AM »
THANK YOU! Got it working, Finally.

Problem:
Your web server(s) are located on your internal network behind your SME Server & Gateway; however you want outside users to be able to access the site.

Solution:

(server-#)
Code: [Select]
nano /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/VirtualHosts/26reverseproxydir

Add (customize capitalized text):

Code: [Select]
{
    if ( $virtualHost eq "DOMAIN.COM" ) {
        $OUT .= "    # theses dirs are reverse proxyed to an internal server\n" ;
        $OUT .= "    ProxyPass /orders http://INTERNAL IP ADDRESS/\n" ;
        $OUT .= "    ProxyPassReverse /orders http://INTERNAL IP ADDRESS/\n" ;
        $OUT .= "\n" ;
        }
}


Save the file

(server-#)
Code: [Select]
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf

solo

Forwarding traffic for virtual domain. Help, Please.
« Reply #6 on: August 05, 2007, 07:23:04 AM »
Sorry pfloor!
I hadn't seen your response.
Thank you so much. Every "heavy" computer knows how much of a relief it is to solve a really frustrating problem. Thanks for helping.

Offline pfloor

  • *****
  • 889
  • +1/-0
Forwarding traffic for virtual domain. Help, Please.
« Reply #7 on: August 05, 2007, 07:25:43 AM »
Quote from: "solo"
Sorry pfloor!
I hadn't seen your response.
Thank you so much. Every "heavy" computer knows how much of a relief it is to solve a really frustrating problem. Thanks for helping.

No problem.  Did you try the built-in db commands or did you stick with your custom template?
In life, you must either "Push, Pull or Get out of the way!"

solo

Forwarding traffic for virtual domain. Help, Please.
« Reply #8 on: August 05, 2007, 07:27:32 AM »
I'm gonna undo what I did and do it your way.
I trust your way is the proper way to do it.

solo

Forwarding traffic for virtual domain. Help, Please.
« Reply #9 on: August 05, 2007, 07:34:24 AM »
Alright, that was sweet and easy. I really do appreciate your help. Such a relief!

Offline pfloor

  • *****
  • 889
  • +1/-0
Forwarding traffic for virtual domain. Help, Please.
« Reply #10 on: August 05, 2007, 08:18:48 AM »
Quote from: "solo"
Alright, that was sweet and easy. I really do appreciate your help. Such a relief!


And I added it to the wiki here:

http://wiki.contribs.org/SME_Server:Documentation:FAQ#Proxy_Pass
In life, you must either "Push, Pull or Get out of the way!"

Offline raem

  • *
  • 3,972
  • +4/-0
Forwarding traffic for virtual domain. Help, Please.
« Reply #11 on: August 06, 2007, 06:04:47 AM »
pfloor

Quote
db domains setprop www."domain".com TemplatePath ProxyPassVirtualHosts ProxyPassTarget http://IP.Address.of.internal.server/path_if_needed/
expand-template /etc/httpd/conf/httpd.conf
/etc/init.d/httpd-e-smith restart[/code]


That didn't work for me, but this did, from one of your posts
http://forums.contribs.org/index.php?topic=38058.0

db domains set domain.to.proxy domain Nameservers internet
db domains setprop domain.to.proxy ProxyPassTarget http://x.x.x.12/
db domains setprop domain.to.proxy TemplatePath ProxyPassVirtualHosts
signal-event domain-create domain.to.proxy
...

Offline pfloor

  • *****
  • 889
  • +1/-0
Forwarding traffic for virtual domain. Help, Please.
« Reply #12 on: August 06, 2007, 06:23:33 AM »
Quote from: "RayMitchell"
pfloor

Quote
db domains setprop www."domain".com TemplatePath ProxyPassVirtualHosts ProxyPassTarget http://IP.Address.of.internal.server/path_if_needed/
expand-template /etc/httpd/conf/httpd.conf
/etc/init.d/httpd-e-smith restart[/code]


That didn't work for me, but this did, from one of your posts
http://forums.contribs.org/index.php?topic=38058.0

db domains set domain.to.proxy domain Nameservers internet
db domains setprop domain.to.proxy ProxyPassTarget http://x.x.x.12/
db domains setprop domain.to.proxy TemplatePath ProxyPassVirtualHosts
signal-event domain-create domain.to.proxy

There I go getting things mixed up in my head again.  You are correct, I will fix the wiki, thanks Ray.

Interesting however, it appeared to work for the OP.  It is probably because he already has the domain configured.  I know this code is not complete and Charlie is looking at finishing it and adding ProxyPass to the domains panel.  I will make sure he knows about this.

Thanks again Ray!

-Paul
In life, you must either "Push, Pull or Get out of the way!"

Offline raem

  • *
  • 3,972
  • +4/-0
Forwarding traffic for virtual domain. Help, Please.
« Reply #13 on: August 06, 2007, 06:38:40 AM »
paul

Quote
There I go getting things mixed up in my head again.
Interesting however, it appeared to work for the OP.  It is probably because he already has the domain configured.
 

Hey you're doing great, as we all are. It's hard to keep up with Charlie & Gordon and all the rest of the team as so many 'good' changes are happening all the time.

I took a working "proxypass'd with contrib" domain offline, so I had to get it up again asap so didn't analyse "why not" at the time, but that's probably the reason.
I'll look at it again later when time permits and track the sequence of events.

Quote
I know this code is not complete and Charlie is looking at finishing it and adding ProxyPass to the domains panel.  I will make sure he knows about this.


That will be good.
Interestingly I was able to edit the domain panel in 7.2 for the proxypass'd domain and add a description & select the primary ibay (I know it won't have any effect but it was to avoid confusion to other admins) and Save it without breaking the proxypass. It just added those db entries.
...