Koozali.org: home of the SME Server

Obsolete Releases => SME Server 7.x => Topic started by: lemonidas on August 03, 2010, 09:13:36 PM

Title: How can I have apache in a different machine?
Post by: lemonidas on August 03, 2010, 09:13:36 PM
I recently installed this great great server os, and I have spent the last 2 days trying to figure out the following (and probably breaking many many things in the process).

I have the SME server connected to a DSL modem (Modem:192.168.178.1 SME ext if:192.168.178.2). Before installing SME I had a freeBSD box running apache (and all the other services that I wanted SME for), and I need to keep the apache on it.

So what I need is a way to keep mail for mydomain.com on SME but when I hit mydomain.com I want it to redirect to 10.0.0.1 (freebsd). SME is 10.0.0.10 in the LAN.

The first thing I tried was port forwarding 80 to 10.0.0.1:80 , but nothing happened.
Then I defined www.mydomain.com in domains to point to 10.0.0.1, and that worked for www.mydomain.com, but of course not for mydomain.com

I suppose that I need to have SME setup as mydomain.com for the mail user@mydomain.com to work through SME.

I then tried various vhost examples I found (which I am too embarrassed to reveal), and I managed to view mydomain.com/www.mydomain.com from inside the network (while still being able to see https://10.0.0.10/server-manager) (my DSL modem supports loopback so I can see mydomain.com from inside the network). Stupidly I thought that it worked, and called it a day.

But obviously it didn't, so here  I am, asking for your help :)

Any ideas?

PS: any changes I made were directly to "/etc/httpd/conf/httpd.conf" and then "httpd -k graceful" but I have kept a backup, in case I screw something (which I probably did)

PS2: I have ssh access (on a non-standard port)
Title: Re: How can I have apache in a different machine?
Post by: Stefano on August 03, 2010, 09:34:16 PM
Hi, welcome here

Any ideas?

yes.. I suggest you to read carefully the documentation and to take a look at the wiki (http://wiki.contribs.org/Domain_practical_usage_tips)..

Quote
PS: any changes I made were directly to "/etc/httpd/conf/httpd.conf" and then "httpd -k graceful" but I have kept a backup, in case I screw something (which I probably did)

you should never edit directly  conf files.. anyway, backup files are not necessary.. you can always restore the configuration "expanding" the right template

please take some time to learn how SME works (db, templates, fragments, events).. all you need to know about SME is in the wiki :-)

HTH
Title: Re: How can I have apache in a different machine?
Post by: lemonidas on August 03, 2010, 09:51:48 PM
Well  I did read (again and again) the documentation, but thanks anyway, I'm sure I have lots of reading to do.

It's just that I'm too new to this sort of thing, but I have to make this work first (the apache part) since there are sites running of it.

As I said, I read the documentation (both on the wiki, and in other sites) but my situation is not covered (or I couldn't find it). The closest I could find, is a way to point a subdir to a different machine, whereas I want anything on port 80 to go to my freebsd box. and initially I thought that PF would be sufficient (as I read in some forum posts), but I was wrong once again...

Title: Re: How can I have apache in a different machine?
Post by: Stefano on August 03, 2010, 10:24:54 PM
maybe Proxy pass (http://wiki.contribs.org/SME_Server:Documentation:FAQ#Proxy_Pass) is what you need
Title: Re: How can I have apache in a different machine?
Post by: lemonidas on August 03, 2010, 10:31:23 PM
this was the first thing I tried after PF didn't work.

the result was that I couldn't log into server-manager because of some ssl error.
The problem I think was that the SME server is setup as: mydomain.com and the domain I used for the commands in the wiki article was also mydomain.com, so some conflict must have happened there..
Title: Re: How can I have apache in a different machine?
Post by: CharlieBrady on August 03, 2010, 11:47:24 PM
Before installing SME I had a freeBSD box running apache (and all the other services that I wanted SME for), and I need to keep the apache on it.

So what you need is one virtual domain to continue to run on your freeBSD box. And you can use a proxy pass virtual domain configuration for that.
Title: Re: How can I have apache in a different machine?
Post by: lemonidas on August 04, 2010, 08:53:48 AM
So what you need is one virtual domain to continue to run on your freeBSD box. And you can use a proxy pass virtual domain configuration for that.


I guess so, but I need the domain name to be exactly the same with the domain used in sme.
Title: Re: How can I have apache in a different machine?
Post by: janet on August 04, 2010, 11:47:19 AM
lemonidas

Quote
I need the domain name to be exactly the same with the domain used in sme.

Look at the Hostnames and Addresses panel.
Point www.yourdomain to your freeBSD box.
IIRC you need to restart your server after making this change.
Title: Re: How can I have apache in a different machine?
Post by: lemonidas on August 04, 2010, 12:05:23 PM
lemonidas

Look at the Hostnames and Addresses panel.
Point www.yourdomain to your freeBSD box.
IIRC you need to restart your server after making this change.

That works for www.mydomain.com but not for mydomain.com...

What if I modified apache on sme to listen on port 81 and then just PF port 80 to freebsd?
Title: Re: How can I have apache in a different machine?
Post by: lemonidas on August 04, 2010, 12:52:14 PM
Well seems like Proxy Pass (GUI) did eventually work (let's hope it lasts)  :???:

I did the exact same thing but with the gui panel and it seems to work as it's supposed to now.

I just hope I don't break it now.

In any case thanks a ton for all the help!  :grin:
Title: Re: How can I have apache in a different machine?
Post by: Stefano on August 04, 2010, 01:11:32 PM
I did the exact same thing but with the gui panel and it seems to work as it's supposed to now.

what gui panel? proxypass has not a web panel, at least in current stable SME

Quote
I just hope I don't break it now.

you will break it if you modify the conf files, i.e. not using the SME's way..
Title: Re: How can I have apache in a different machine?
Post by: lemonidas on August 05, 2010, 01:06:42 PM
what gui panel? proxypass has not a web panel, at least in current stable SME

you will break it if you modify the conf files, i.e. not using the SME's way..


I installed the rpm of proxypass (fixed the bug using the instructions in another thread) and it worked.

The problem is that it places entries for proxypass in both the :80 and :443 virtualhosts sections of httpd.conf

I can't seem to find the 'SME way' of fixing this (since I need the 443 to point normally to SME for webmail to work), and using proxypass from the cli (as described in the wiki) breaks my httpd.conf beyond recognition (ssl error, can't login to server-manager, everything broken) probably because the domain I'm trying to set with proxypass is the same with my primary domain.

The only way to fix this (temporarily) is to use proxypass gui, setup a proxypass to 10.0.0.1 and then go in manually and comment out the entries in the :443 section.

 :sad:
Title: Re: How can I have apache in a different machine?
Post by: CharlieBrady on August 05, 2010, 02:08:35 PM
I can't seem to find the 'SME way' of fixing this (since I need the 443 to point normally to SME for webmail to work), ...

Configure a virtual domain (in SME server, and in DNS) and use that virtual domain to access webmail.