[HCoop-Help] Having both https and http enabled

Adam Chlipala adamc at hcoop.net
Sat Mar 1 11:16:03 EST 2008


Tanveer Singh wrote:
> I have a domain ihro.in which i configured using this domtool config.
> dom "ihro.in" where
>         DocumentRoot = home "ihro_html";
>         SSL = use_cert "/etc/apache2/ssl/apache.pem";
>         DefaultAlias = false;
> with
>         nameserver "ns1.hcoop.net";
>         nameserver "ns3.hcoop.net";
>         (* email *)
>         handleMail;
>         emailAlias "admin" "tanveer";
>         emailAlias "d.s.gill" "<hidden>";
>         defaultAlias "<hidden>";
> end;
>   

I recently started going through everyone's Domtool config in 
alphabetical order, and I haven't reached yours yet.  Here is the basic 
advice I would have given if I had:

You shouldn't use 'nameserver', 'handleMail', or 'defaultAlias' 
directives unless you have a special reason, and I don't think you do 
here.  I know there were some bad examples on the FullExamples wiki page 
that did this, but I've gotten rid of those now.

The appropriate equivalent refactoring of the configuration you sent is:

dom "tpu.org" where
  DocumentRoot = home "ihro_html";
  SSL = use_cert "/etc/apache2/ssl/apache.pem";
  Mailbox = "default.alias at wherever";
with
  emailAlias "admin" "tanveer";
  emailAlias "d.s.gill" "someone at wherever";
end;

> Now this site opens just via https, not via http, so I made these
> changes, and now ihro.in reads like this
>
> dom "ihro.in" where
>         DocumentRoot = home "ihro_html";
>         SSL = use_cert "/etc/apache2/ssl/apache.pem";
>         DefaultAlias = false;
> with
>         nameserver "ns1.hcoop.net";
>         nameserver "ns3.hcoop.net";
>         (* email *)
>         handleMail;
>         emailAlias "admin" "tanveer";
>         emailAlias "d.s.gill" "<hidden>";
>         defaultAlias "<hidden>";
> end;
> dom "ihro.in" where
>         DocumentRoot = home "ihro_html";
>         DefaultAlias = false;
> with
>          nameserver "ns1.hcoop.net";
>          nameserver "ns3.hcoop.net";
> end;
>   

This is Bad.  You should only have one block of configuration per 
domain.  I think you are conflating domain configuration blocks and web 
virtual host blocks.  A proper final configuration is this:

dom "tpu.org" where
  DocumentRoot = home "ihro_html";
  Mailbox = "default.alias at wherever";
with
  emailAlias "admin" "tanveer";
  emailAlias "d.s.gill" "someone at wherever";

  vhost "www" where
    SSL = use_cert "/etc/apache2/ssl/apache.pem";
  with end;
end;

I somewhat arbitrarily chose to get 'dom' to create the non-SSL vhost 
and do the SSL vhost manually, since this makes the configuration one 
line shorter, because 'no_ssl' is the default value of 'SSL'.

_______________________________________________
HCoop-Help mailing list
HCoop-Help at lists.hcoop.net
https://lists.hcoop.net/listinfo/hcoop-help




More information about the HCoop-Help mailing list