Koozali.org: home of the SME Server

how to create a sub domain in SME 7.2

Offline phalon

  • **
  • 23
  • +0/-0
    • http://www.sdp.gob.hn
how to create a sub domain in SME 7.2
« on: March 07, 2008, 05:42:58 PM »
I need to create a subdomain in my sme server 7.2. And the only options that I find is the one to make hostsnames and address and also Domain option but it only allows sme to create primary domains of websites.

If someone can help, I will be very greatfull.

Thanks

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: how to create a sub domain in SME 7.2
« Reply #1 on: March 07, 2008, 07:05:02 PM »
I need to create a subdomain in my sme server 7.2. And the only options that I find is the one to make hostsnames and address and also Domain option but it only allows sme to create primary domains of websites.

If someone can help, I will be very greatfull.

Thanks

  • Choose the name of you subdomain
  • Create a folder for the subdomain in the templates-custom httpd configuration tree:

    mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/subdomain-FQDN

    e.g.

    mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/subdomain.domain.countrycode

  • Copy at least the following template fragments from /etc/templates/etc/httpd/conf/httpd.cong/Virtualhosts to the just created folder, using:

    cp /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/VirtualHost/filename /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/subdomain.domain.countrycode

    • template-begin
    • 00Setup
    • 02ServerName
    • 25SSLDirectives
    • 26RewriteTraceAndTrack
    • 50DirectoryIndex*
    • 85DefaultAccess
    • template-end

  • To add the content of your new subdomain you will have to make a new template fragment there that starts with a number of 90 or higher to keep the correct order of files. That file should hold the DocumentRoot and necessary alias/location/directory configuration for you domain, this can be found in the apache documentation.
  • If you not already created your subdomain through the domains panel in the server-manager you should now do so, it does not matter which ibay you choose for it as this will be overridden by the setttings of the file you created in the previous step.

    The minimal setting should be something like this:

        DocumentRoot  /path/to/subdomain/documentroot

  • Verify the subdomain is created properly:

    db accounts show subdomain.domain.countrycode

    which should something like this:

    subdomain.domain.countrycode=domain
        Content=Primary
        Description=Description
        Nameservers=internet
        owner=group


  • Now we need to instruct the configuration mechanism not to use the defaul templates for the subdomain but use the one you just created:

    db accounts setprop subdomain.domain.countrycode TemplatePath subdomain.domain.countrycode

    After above command the output of

    db accounts show subdomain.domain.countrycode

    should now look like this

    subdomain.domain.countrycode=domain
        Content=Primary
        Description=Description
        TemplatePath=subdomain.domain.countrycode
        Nameservers=internet
        owner=group


  • The last steps are to regenerate the configuration file of the webserver:

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

  • Test the configuration file before restarting your webserver like this

    httpd -t

    If everything is OK it will output something like this

    Syntax OK

    If not it will point you to the location of the error.
  • Once everything is OK you can restart your webserver:

    sv t httpd-e-smith

  • Now the subdomain should be available depending on your sttings in the 90something file content might be shown, if not be sure to check the /var/log/messages and the /var/log/httpd/error_log and /var/log/httpd/access_log files for clues.

Disclaimer: this is a quick instruction which is not tested and done from memory so it could be there are crucial steps missing or that information is inaccurate. If things might not work after following the instructions you can reset things to their original state by the following three steps:
  • removing the subdomain from your server through server-manager
  • Remove the directoty and it's conten that is created in step 2 of the instruction.
  • After that issue the following commands

    expand-template /etc/httpd/conf/httpd.conf
    sv t httpd-e-smith
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline phalon

  • **
  • 23
  • +0/-0
    • http://www.sdp.gob.hn
Re: how to create a sub domain in SME 7.2
« Reply #2 on: March 07, 2008, 07:12:40 PM »
Thank you very much for the info, I'll follow your instructions. If something else comes up, I'll write again.

Offline pfloor

  • *****
  • 889
  • +1/-0
Re: how to create a sub domain in SME 7.2
« Reply #3 on: March 07, 2008, 09:17:15 PM »
You can use the "Domains" panel to create subdomain.maindomain.com and point it to any ibay you want. 

Note: One small side effect is it creates some additional subdomains (eg. mail.subdomain.maindomain.com, etc) but those can be removed in the hostname panel if you desire.
In life, you must either "Push, Pull or Get out of the way!"