Hi all
Something thats bugged me off & on for a good while finally drove me to investigate it in detail & come up with a solution.
I have a number of clients that use an SME as a proxy/gateway & usually email, but they have their website hosted externally; the system may or may not have an internal Windows server providing DNS/DHCP, it doesn't seem to matter.
When the clients site is hosted externally I have gone to the hostnames panel & changed the 'www' host to point to the external IP, saved, only to find that the www is still resolved to the SME no matter what I do; I have done a full signal-event update cycle to see if it fixes, nope; changed DNS resolution to point to SME explicitly, nope; cleaned out the Squid cache, nope; cleaned the browser cache, nope; turned off squid, nope, use a different computer, nope .. funnily enough I never tried turning off the HTTP proxy as I didn't expect it to be Apache, at least to start with.
If I ping the hostname it resolves correctly, be it from the SME itself or a workstation, but try to access via a browser & we get the SME.
After a bit of digging around it seems the issue is with Apache, let me explain.
Within the httpd.conf file the main website name is hard coded to be 'www' so that no matter what I change elsewhere if the httpd proxy is enabled (as it is by default) Apache sees the call for www as a request it must resolve itself, & promptly does.
The solution/workaround turned out to be rather simple.
The first thing I did was create a db variable called WebHostName & set it to www2: db configuration set WebHostName www2
The second thing was to create a template fragment in /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf called 45ServerName (I actually copied the orig from /etc/e-smith/templates/etc/httpd/conf/httpd.conf) & edited it so that:
ServerName www.{ $DomainName }
became
ServerName { $WebHostName }.{ $DomainName }
then signal-event post-upgrade; signal-event reboot (tho signal-event ibay-modify would probably suffice)
The upshot is that now Apache doesn't grab the request for www & all is sweetness & light
.
I can think of several better ways to make this change more robust & elegant but at the moment this works for me. I may tweak it by adding in some logic to the template so that if the www record doesn't point to the local server then the local website uses the physical system name (the SystemName variable in the config file).
If anyone has a better idea let me know. I'll build this into a howto later once the best way is decided; it may also be worth posting as a bug & let the devs review it as I figure SME8 may well behave the same tho I haven't tested this so it is mere supposition. If someone here that can test this it be good to post up your results. If it does behave the same I post a link in the SME8 forum to this post.
HTH