Koozali.org: home of the SME Server

Webserver Alias to another ibay

hackersoft

Webserver Alias to another ibay
« on: July 16, 2006, 11:41:06 AM »
Hello To All!
Is there a way to create an alias to another ibay directory so no duplication of files is necessary just in the case below:

I tried to edit the httpd config but has no effect since when I create a new domain, the alias is also removed.

Thanks For Any Help!

Offline raem

  • *
  • 3,972
  • +4/-0
Re: Webserver Alias to another ibay
« Reply #1 on: July 16, 2006, 12:20:55 PM »
hackersoft

> I tried to edit the httpd config but has no effect since when I create a
> new domain, the alias is also removed.

When you make manual changes to sme configuration files, you have to make them using custom templates or your changes will be overwritten the next time you change something in server manager.

See the Developer link for Developers Guide documentation for explanation of using custom templates, and read these forums and howtos for many examples of how this is done.

See some Howtos here
http://no.longer.valid/phpwiki/index.php?ContribsPage

and also (as the contribs area is no longer searchable) see the many howtos in the user's contribs area
http://mirror.contribs.org/smeserver//contribs/
...

hackersoft

Webserver Alias to another ibay
« Reply #2 on: July 16, 2006, 12:37:06 PM »
Thanks for the quick reply.
I'll try your tips.

hackersoft

Webserver Alias to another ibay
« Reply #3 on: July 17, 2006, 05:23:24 AM »
I've searched through this site but it seems that my searching capability is not enough and can't find the answers myself.

I hope there's a way to add aliases via the server-manager for each domain so there's no need to hand code.

Any example of custom templates and how it works for an alias in a webserver? I can't seem to create one...

Here's the situation:
I have two domains http://firstdomain.net and http://secondomain.net

http://firstdomain.net has a subfolder /testsite which I want to alias with the http://secondomain.net

Any possibilities of doing this in SME...
Thanks!

Offline mmccarn

  • *
  • 2,656
  • +10/-0
Webserver Alias to another ibay
« Reply #4 on: July 17, 2006, 01:52:23 PM »
I must be missing something - it looks like all you have to do is
    a) create an "ibay" named "testsite" - this will appear at http:/firstdomain.net/testsite
    b) create "secondomain.net" and tell it to use the "testsite" ibay


Everything should work as you want...

Admittedly, the "testsite" folder is not a sub-folder of the "html" folder for "firstdomain.net".  Is that a problem?

If the above solution doesn't work for you then you need to

    1) figure out exactly what changes you need to make to "httpd.conf" to get the desired effect.
    2) figure out which "template fragment" in /etc/e-smith/templates/etc/httpd/conf/httpd.conf would best incorporate your changes.  (note: if none of the existing template fragments looks appropriate, you can create your own filename in steps 3 & 4 below - just pick a lead-in number that will cause expand-template to put it in an appropriate place in the final "conf" file - e.g. "98MyTemplateFragment")
    3) copy the template fragment you identify in step 2 into /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf (creating this dir if necessary)
    4) edit the new copy of the "template fragment" in "templates-custom" to incorporate your changes
    5) rebuild the /etc/httpd/conf/httpd.conf using "
expand-template /etc/httpd/conf/httpd.conf"
6) restart the web server using "/etc/init.d/httpd restart"[/list]

Using template fragments in this manner allows you to edit "httpd.conf" in such a way that
    * the configuration is backed up using SME's backup tools
    * your configuration changes have a good chance of surviving an upgrade to a new version of SME Server
    * if useful, your configuration changes can be shared with the community to benefit others with the same problem.


You *can* edit "httpd.conf" directly, then restart httpd to activate your changes.  I do this for testing, then move my changes into a custom template fragement.  If you don't move your changes into a custom template fragment they will disappear when you reboot or install SME software updates (or run "expand-template /etc/httpd/conf/httpd.conf")...

Offline mmccarn

  • *
  • 2,656
  • +10/-0
Webserver Alias to another ibay
« Reply #5 on: July 17, 2006, 01:56:28 PM »
It just occured to me that you could also:

1. create ibay "testsite"
2. point secondomain.net to ibay testsite

3. create a link from /home/e-smith/files/ibays/Primary/html/ to /home/e-smith/files/ibays/testsite/html

Now, if you login to firstdomain.net using ftp and upload files to /testsite they should show up in secondomain.net.

Caveats:
a) I've got NO IDEA if this will really work
b) I suspect you will at least need to manually modify file permissions somewhere...

Offline mdo

  • *
  • 355
  • +0/-0
Webserver Alias to another ibay
« Reply #6 on: July 17, 2006, 08:56:13 PM »
Quote from: "mmccarn"

6) restart the web server using "/etc/init.d/httpd restart"


Be careful, the correct way to restart SME's web servers is:

/etc/rc7.d/S86httpd-e-smith restart
/etc/rc7.d/S86httpd-admin restart

Michael
...