<?xml version="1.0" encoding="utf-8"?><!DOCTYPE article  PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'  'http://www.docbook.org/xml/4.4/docbookx.dtd'><article><articleinfo><title>DomTool/Examples</title><revhistory><revision><revnumber>77</revnumber><date>2022-02-10 16:18:48</date><authorinitials>2603:7080:493d:db56:2d52:b733:fa7c:b161</authorinitials><revremark>added example of using external mailserver</revremark></revision><revision><revnumber>76</revnumber><date>2019-04-27 23:48:35</date><authorinitials>ClintonEbadi</authorinitials></revision><revision><revnumber>75</revnumber><date>2019-04-27 23:46:36</date><authorinitials>ClintonEbadi</authorinitials><revremark>basic example of new proxyRewrite directive</revremark></revision><revision><revnumber>74</revnumber><date>2019-01-08 03:28:03</date><authorinitials>ClintonEbadi</authorinitials><revremark>mod_rewrite traces are logged to regular error.log now</revremark></revision><revision><revnumber>73</revnumber><date>2018-10-22 19:43:32</date><authorinitials>ClintonEbadi</authorinitials><revremark>ForceSSL is TRUE by default, update example</revremark></revision><revision><revnumber>72</revnumber><date>2018-10-20 18:43:03</date><authorinitials>ClintonEbadi</authorinitials><revremark>basic docs for webSsl directive... examples still need a really thorough review and update</revremark></revision><revision><revnumber>71</revnumber><date>2018-10-20 18:35:25</date><authorinitials>ClintonEbadi</authorinitials><revremark>placing anything not meant to be served from hcoop.net/~YOU in ~/public_html considered dangerous</revremark></revision><revision><revnumber>70</revnumber><date>2015-09-18 04:09:51</date><authorinitials>ClintonEbadi</authorinitials><revremark>spurious `with' in wordpress `WWW' example</revremark></revision><revision><revnumber>69</revnumber><date>2015-04-13 19:15:37</date><authorinitials>ClintonEbadi</authorinitials><revremark>catch-alls have not been enabled by default for a looooong time</revremark></revision><revision><revnumber>68</revnumber><date>2014-12-21 06:44:11</date><authorinitials>DavidKerschner</authorinitials><revremark>Removed section about dynamic dns. The security hole this relied upon has been patched.</revremark></revision><revision><revnumber>67</revnumber><date>2014-04-14 07:23:31</date><authorinitials>ClintonEbadi</authorinitials><revremark>update moinMoin and wordPress syntax</revremark></revision><revision><revnumber>66</revnumber><date>2013-01-14 07:23:06</date><authorinitials>ClintonEbadi</authorinitials><revremark>installing wordpress from svn seems like a good thing to mention</revremark></revision><revision><revnumber>65</revnumber><date>2013-01-14 07:03:01</date><authorinitials>ClintonEbadi</authorinitials><revremark>cat</revremark></revision><revision><revnumber>64</revnumber><date>2013-01-04 21:31:30</date><authorinitials>ClintonEbadi</authorinitials><revremark>addDefaultSPF</revremark></revision><revision><revnumber>63</revnumber><date>2012-04-17 09:12:52</date><authorinitials>52.41.138.58.dy.bbexcite.jp</authorinitials><revremark>better find</revremark></revision><revision><revnumber>62</revnumber><date>2010-01-01 20:17:26</date><authorinitials>93-173-106-194.bb.netvision.net.il</authorinitials></revision><revision><revnumber>61</revnumber><date>2010-01-01 20:10:58</date><authorinitials>AdamChlipala</authorinitials><revremark>Avoid duplicating an env var setting</revremark></revision><revision><revnumber>60</revnumber><date>2010-01-01 19:58:28</date><authorinitials>93-173-106-194.bb.netvision.net.il</authorinitials></revision><revision><revnumber>59</revnumber><date>2009-12-08 23:53:08</date><authorinitials>93-173-241-32.bb.netvision.net.il</authorinitials></revision><revision><revnumber>58</revnumber><date>2009-12-08 23:50:18</date><authorinitials>93-173-241-32.bb.netvision.net.il</authorinitials></revision><revision><revnumber>57</revnumber><date>2009-12-07 17:56:30</date><authorinitials>jasper.cs.tamu.edu</authorinitials><revremark>Added an example of how to get wordpress working on the default domain, without need for a subdomain or extra path element in the URL.</revremark></revision><revision><revnumber>56</revnumber><date>2009-06-09 05:14:26</date><authorinitials>RobinTempleton</authorinitials><revremark>new dynamic dns script</revremark></revision><revision><revnumber>55</revnumber><date>2009-04-10 09:35:26</date><authorinitials>dyn-62-56-97-83.dslaccess.co.uk</authorinitials></revision><revision><revnumber>54</revnumber><date>2009-04-10 09:34:04</date><authorinitials>dyn-62-56-97-83.dslaccess.co.uk</authorinitials><revremark>Added section on redirecting from www.mydomain to mydomain</revremark></revision><revision><revnumber>53</revnumber><date>2009-04-09 16:35:55</date><authorinitials>AdamChlipala</authorinitials><revremark>vhostDefault example</revremark></revision><revision><revnumber>52</revnumber><date>2008-09-28 13:53:39</date><authorinitials>AdamChlipala</authorinitials><revremark>SSI</revremark></revision><revision><revnumber>51</revnumber><date>2008-08-14 12:50:22</date><authorinitials>AdamChlipala</authorinitials><revremark>catchAllAlias is gone.</revremark></revision><revision><revnumber>50</revnumber><date>2008-07-07 04:28:05</date><authorinitials>localhost</authorinitials><revremark>converted to 1.6 markup</revremark></revision><revision><revnumber>49</revnumber><date>2008-05-19 21:06:07</date><authorinitials>DavorOcelic</authorinitials></revision><revision><revnumber>48</revnumber><date>2008-04-09 00:23:38</date><authorinitials>MichaelOlson</authorinitials><revremark>Make WhyNotHtaccess a subpage</revremark></revision><revision><revnumber>47</revnumber><date>2008-04-08 00:14:51</date><authorinitials>AdamChlipala</authorinitials><revremark>WhyNoHtaccess</revremark></revision><revision><revnumber>46</revnumber><date>2008-04-07 23:54:31</date><authorinitials>AdamChlipala</authorinitials><revremark>Simple web site examples</revremark></revision><revision><revnumber>45</revnumber><date>2008-04-05 20:29:18</date><authorinitials>AdamChlipala</authorinitials><revremark>Whoops; wrong directive</revremark></revision><revision><revnumber>44</revnumber><date>2008-04-05 20:26:31</date><authorinitials>AdamChlipala</authorinitials><revremark>dnsDefaultIP</revremark></revision><revision><revnumber>43</revnumber><date>2008-04-03 18:44:47</date><authorinitials>AdamChlipala</authorinitials><revremark>English 911</revremark></revision><revision><revnumber>42</revnumber><date>2008-04-01 19:48:56</date><authorinitials>bzq-84-108-20-56.cablep.bezeqint.net</authorinitials></revision><revision><revnumber>41</revnumber><date>2008-04-01 19:39:40</date><authorinitials>bzq-84-108-20-56.cablep.bezeqint.net</authorinitials></revision><revision><revnumber>40</revnumber><date>2008-02-25 18:55:30</date><authorinitials>BjörnLindström</authorinitials></revision><revision><revnumber>39</revnumber><date>2008-02-24 16:20:04</date><authorinitials>AdamChlipala</authorinitials><revremark>Explain wordpress</revremark></revision><revision><revnumber>38</revnumber><date>2008-02-02 21:13:21</date><authorinitials>AdamChlipala</authorinitials><revremark>Show skip flag</revremark></revision><revision><revnumber>37</revnumber><date>2008-02-02 16:37:03</date><authorinitials>AdamChlipala</authorinitials><revremark>More mod_rewrite examples</revremark></revision><revision><revnumber>36</revnumber><date>2007-12-29 02:36:13</date><authorinitials>AdamChlipala</authorinitials><revremark>Drastic refactor to remove all possibilities for someone to look at a single example and draw a bad conclusion</revremark></revision><revision><revnumber>35</revnumber><date>2007-12-16 22:19:40</date><authorinitials>AdamChlipala</authorinitials><revremark>cgiExtension</revremark></revision><revision><revnumber>34</revnumber><date>2007-12-16 15:04:29</date><authorinitials>AdamChlipala</authorinitials><revremark>followSymLinks</revremark></revision><revision><revnumber>33</revnumber><date>2007-12-16 15:03:02</date><authorinitials>AdamChlipala</authorinitials><revremark>IPv6</revremark></revision><revision><revnumber>32</revnumber><date>2007-12-16 14:39:25</date><authorinitials>BjörnLindström</authorinitials><revremark>Replaced domNoWWW with CreateWWW = false</revremark></revision><revision><revnumber>31</revnumber><date>2007-12-16 06:50:32</date><authorinitials>nl105-254-74.student.uu.se</authorinitials><revremark>domNoDefaultAlias deprecated</revremark></revision><revision><revnumber>30</revnumber><date>2007-12-16 06:04:22</date><authorinitials>DanielVerkamp</authorinitials><revremark>fix syntax error in access control example</revremark></revision><revision><revnumber>29</revnumber><date>2007-12-11 03:18:49</date><authorinitials>59.94.210.15</authorinitials></revision><revision><revnumber>28</revnumber><date>2007-11-23 20:41:19</date><authorinitials>RyanMikulovsky</authorinitials><revremark>mention domNoDefaultAlias</revremark></revision><revision><revnumber>27</revnumber><date>2007-11-22 20:08:45</date><authorinitials>AdamChlipala</authorinitials><revremark>Removed 'handleMail' from Mailman example, because 'dom' already includes that.</revremark></revision><revision><revnumber>26</revnumber><date>2007-11-19 03:12:21</date><authorinitials>MichaelOlson</authorinitials><revremark>add handleMail to mailman example</revremark></revision><revision><revnumber>25</revnumber><date>2007-11-19 03:07:52</date><authorinitials>MichaelOlson</authorinitials><revremark>Use &quot;mailman&quot;.  explain what it does</revremark></revision><revision><revnumber>24</revnumber><date>2007-11-19 01:01:34</date><authorinitials>MichaelOlson</authorinitials><revremark>Add ssl usage for simple vhost</revremark></revision><revision><revnumber>23</revnumber><date>2007-11-18 23:23:54</date><authorinitials>AdamChlipala</authorinitials><revremark>Web apps</revremark></revision><revision><revnumber>22</revnumber><date>2007-11-18 18:15:57</date><authorinitials>AdamChlipala</authorinitials><revremark>SSL example</revremark></revision><revision><revnumber>21</revnumber><date>2007-11-15 13:05:56</date><authorinitials>AdamChlipala</authorinitials><revremark>Clarify alias permissions</revremark></revision><revision><revnumber>20</revnumber><date>2007-11-12 02:46:44</date><authorinitials>MichaelOlson</authorinitials><revremark>Add link to working examples subpage</revremark></revision><revision><revnumber>19</revnumber><date>2007-11-11 18:18:27</date><authorinitials>AdamChlipala</authorinitials><revremark>Model T with customized www.yourdomain</revremark></revision><revision><revnumber>18</revnumber><date>2007-11-08 20:35:37</date><authorinitials>MichaelOlson</authorinitials><revremark>add dnsDefault line to canonical DNS example</revremark></revision><revision><revnumber>17</revnumber><date>2007-10-27 18:27:55</date><authorinitials>AdamChlipala</authorinitials></revision><revision><revnumber>16</revnumber><date>2007-09-16 15:08:36</date><authorinitials>AdamChlipala</authorinitials><revremark>noDns example</revremark></revision><revision><revnumber>15</revnumber><date>2007-09-14 08:04:34</date><authorinitials>MichaelOlson</authorinitials><revremark>Migrate changes</revremark></revision><revision><revnumber>14</revnumber><date>2007-07-02 23:48:51</date><authorinitials>MichaelOlson</authorinitials><revremark>domtool -&gt; .domtool</revremark></revision><revision><revnumber>13</revnumber><date>2007-07-02 23:33:02</date><authorinitials>MichaelOlson</authorinitials><revremark>Update DNS example to use the new nameservers</revremark></revision><revision><revnumber>12</revnumber><date>2007-06-23 20:44:29</date><authorinitials>212.15.179.73</authorinitials></revision><revision><revnumber>11</revnumber><date>2007-06-23 18:54:35</date><authorinitials>212.15.179.73</authorinitials></revision><revision><revnumber>10</revnumber><date>2007-05-25 22:02:24</date><authorinitials>AdamChlipala</authorinitials><revremark>Kill stray =</revremark></revision><revision><revnumber>9</revnumber><date>2007-05-25 22:00:17</date><authorinitials>AdamChlipala</authorinitials><revremark>Lowercase rewrite*</revremark></revision><revision><revnumber>8</revnumber><date>2007-04-29 21:55:37</date><authorinitials>AdamChlipala</authorinitials><revremark>Some changes regarding domain aliases</revremark></revision><revision><revnumber>7</revnumber><date>2007-04-27 00:21:43</date><authorinitials>AdamChlipala</authorinitials><revremark>Type of SSL env. var. changed</revremark></revision><revision><revnumber>6</revnumber><date>2006-12-17 22:39:34</date><authorinitials>AdamChlipala</authorinitials><revremark>Mailman</revremark></revision><revision><revnumber>5</revnumber><date>2006-12-17 22:37:17</date><authorinitials>AdamChlipala</authorinitials><revremark>Done with Apache examples</revremark></revision><revision><revnumber>4</revnumber><date>2006-12-17 22:22:14</date><authorinitials>AdamChlipala</authorinitials><revremark>More Apache examples</revremark></revision><revision><revnumber>3</revnumber><date>2006-12-17 21:55:46</date><authorinitials>AdamChlipala</authorinitials><revremark>Basic Apache</revremark></revision><revision><revnumber>2</revnumber><date>2006-12-17 21:40:47</date><authorinitials>AdamChlipala</authorinitials><revremark>Mail</revremark></revision><revision><revnumber>1</revnumber><date>2006-12-17 21:31:54</date><authorinitials>AdamChlipala</authorinitials></revision></revhistory></articleinfo><para>Here are some example configuration files for <ulink url="https://wiki.hcoop.net/DomTool/Examples/DomTool#">DomTool</ulink>, our distributed configuration management system. </para><section><title>Domains</title><section><title>The Model T</title><para>If you just want to declare your domain with a <code>www.yourdomain</code> virtual host serving out of <code>~/public_html/</code> and <code>your-hcoop-username@yourdomain</code> mail forwarded to your mailbox, use: </para><screen><![CDATA[dom "yourdomain" with
end;]]></screen><para>Or, if you don't want any mail to be forwarded to your mailbox, use: </para><screen><![CDATA[dom "yourdomain" where
  DefaultAlias = false;
with end;]]></screen></section><section><title>Upgraded Model T</title><para>If you like everything <code>dom</code> gives you but want to add additional configuration, include it between <code>with</code>..<code>end</code>. For instance, to add an extra web virtual host <code>other</code>: </para><screen><![CDATA[dom "yourdomain" with
  web "other" with
    (* More configuration could go here *)
  end;
end;]]></screen></section><section><title>Model T with customized www.yourdomain</title><para>You wouldn't want to copy the last example with <code>&quot;www&quot;</code> instead of <code>&quot;other&quot;</code>, because <code>dom</code> already creates a <code>www</code> vhost.  Instead, there's a more convenient way to configure this most common of vhosts: </para><screen><![CDATA[dom "yourdomain" where
  DocumentRoot = "/my/custom/docroot";
  (* See "Bucking all the trends" in the Apache section for other options you can
     use like DocumentRoot. *)
  WWW = begin
    alias "/from" "/to";
    alias "/from2" "/to2";
    (* These are just examples.  Arbitrary vhost config goes here. *)
  end
with
  (* And other domain configuration can go here, including more vhosts. *)
end;]]></screen></section><section><title>Model T with redirect from www.yourdomain to yourdomain</title><para>To redirect all URLs from <ulink url="http://www.mydomain/some/path/"/> to <ulink url="http://mydomain/some/path/"/> you need to disable the automatic creation of the www host, and then create it manually specifying a permanent redirect rule. </para><screen><![CDATA[dom "mydomain.com" where
 CreateWWW = false;
with
 vhostDefault with
 end;
]]><![CDATA[
 web "www" with
   rewriteRule "^(.*)$" "http://mydomain.com$1" [redirectWith permanent]
 end;
end;]]></screen></section><section><title>Attack of the Model T Clones</title><para>We can take the Model T and use it with some alternate names for the domain we're configuring. </para><screen><![CDATA[dom "yourdomain" where
  Aliases = ["yourotherdomain", "yourotherotherdomain"]
with
end;]]></screen><para>A single Apache virtual host is created, answering to multiple names.  Other configuration is duplicated like you had entered it in a separate <code>dom</code> block for each alias. </para></section><section><title>Subdomain Redirection</title><para>This example aliases a subdomain and redirects it to the &quot;www&quot; virtual host. This means that when accessing yourSubdomain.yourdomain.com you will actually be receiving content defined by www.yourdomain.com. </para><screen><![CDATA[dom "yourdomain.com" where
  CreateWWW = false
with
  dnsIP "yourSubdomain" web_ip;
  web "www" with
    serverAlias "yourSubdomain"
  end
end;]]></screen></section><section><title>The Do-It-Yourself</title><para>The lowest-level way of configuring a domain is the <code>domain</code> directive, which does nothing but set up basic DNS parameters and provide a space for including further directives.  <emphasis role="strong">You shouldn't use the <code>domain</code> directive unless you really know what you're doing when it comes to Internet protocols, and you have a good reason not to like the defaults that <code>dom</code> includes.</emphasis> </para><screen><![CDATA[domain "yourdomain" with
  (* Your directives here *)
end;]]></screen></section></section><section><title>DNS</title><para>Here's a tour through the available DNS features.  You probably don't want to use any <code>nameserver</code>, <code>dnsDefault</code>, or <code>dnsMail</code> directives in  your configuration, since <code>dom</code> will include the proper defaults for you.  It's worth reminding that you probably shouldn't use the <code>domain</code> directive.  We only use it here for illustrative purposes. </para><screen><![CDATA[domain "yourdomain" with
  nameserver "ns1.hcoop.net";
  nameserver "ns3.hcoop.net";
  (* Specify two DNS servers that are authoritative for yourdomain *)
  dnsDefault "69.90.123.68";
  (* Add a mapping from yourdomain to IP address 69.90.123.68 *)
  dnsIP "host" "1.2.3.4";
  (* Add a mapping from host.yourdomain to IP address 1.2.3.4 *)
  dnsMail 23 "mail.yourdomain";
  (* Register mail.yourdomain as an SMTP handler for yourdomain, with priority 23 *)
  dnsAlias "hcoop" "hcoop.net";
  (* Add an alias such that hcoop.yourdomain resolves to the same thing as hcoop.net *)
  dnsIP "dynamic" "5.6.7.8" where
    TTL = 100
  end;
  (* Add an IP mapping with an abnormally low time-to-live of 100, see the section about dynamic DNS below *)
  (* IPv6 alternatives to some of the above *)
  dnsIPv6 "host" "1111:2222:3333:4444:5555:6666:7777:8888";
  dnsDefaultv6 "1111:2222:3333:4444:5555:6666:7777:8888";
  (* Map every remaining hostname to 2.2.2.2. *)
  dnsWildcardIP "2.2.2.2";
end;]]></screen><section><title>Keeping DNS elsewhere</title><para>This example shows how to configure mail handling for a domain that is primarily hosted off of HCoop.  We only use <code>domain</code> instead of <code>dom</code> because <code>dom</code> already includes the <code>handleMail</code> directive that we want to demonstrate. </para><screen><![CDATA[domain "yourdomain" where
  DNS = noDns
with
  handleMail;
end;]]></screen></section></section><section><title>Mail</title><para>We only use <code>domain</code> instead of <code>dom</code> because <code>dom</code> already includes the <code>handleMail</code> directive that we want to demonstrate. </para><screen><![CDATA[domain "yourdomain" with
  handleMail;
  (* HCoop should provide relaying for yourdomain *)
  emailAlias "user1" "user1@gmail.com";
  (* Forward mail from user1@yourdomain to user1@gmail.com *)
  emailAlias "user2" "me";
  (* Forward mail from user2@yourdomain to HCoop user me *)
  aliasMulti "pals" ["pal1@yahoo.com", "pal2@prodigy.com", "pal3"];
  (* Forward mail from pals@yorudomain to pal1@yahoo.com, pal2@prodigy.com, and HCoop user pal3 *)
  aliasDrop "spamtrap";
  (* Silently drop all mail to spamtrap@yourdomain *)
  defaultAlias "me";
  (* Send all yourdomain mail, period, to user me *)
  addDefaultSPF;
  (* Only allow mail to be sent through your MX, typically mail.hcoop.net. *)
end;]]></screen><section><title>External Mailserver</title><para>Using an external mailserver is possible by adding manual DNS records. </para><screen><![CDATA[dom "yourdomain" where
  AddMX = false; (* Removes default mail.hcoop.net DNS record. *)
 with
  dnsMail 10 "mail.externalmailserver.com";
  dnsMail 50 "mail2.externalmailserver.com";
  dnsDefaultText "v=spf1 include:_mailcust.externalmailserver.com ?all"; (* Sets TXT record for verification. *)
end;]]></screen></section></section><section><title>Apache</title><para><code>.htaccess</code> files are not processed on our servers for security reasons, as explained on <ulink url="https://wiki.hcoop.net/DomTool/Examples/DomTool/WhyNoHtaccess#">DomTool/WhyNoHtaccess</ulink>.  See the examples below to learn how to use Apache features that are often controlled with <code>.htaccess</code> files. </para><section><title>The Default</title><para>The standard <code>dom</code> directive gives you a web site at <code>www.yourdomain</code> and <code>yourdomain</code>, pulling content from your <code>~/public_html</code> directory. </para><screen><![CDATA[dom "yourdomain" with
end;]]></screen></section><section><title>Extending the Default</title><para>You can tweak the configuration for your domain's <code>www</code> virtual host like this: </para><screen><![CDATA[dom "yourdomain" where
  DocumentRoot = home "somewhere/else";
  (* Serve static content from ~/somewhere/else. *)
  WWW = begin
    (* Here you can put any of the web configuration directives found in the sections below. *)
  end
with
  (* ...and you can still put other domain configuration here. *)
end]]></screen></section><section><title>Simple Additional Web Sites</title><para>It's easy to add extra web sites to your domain when they just serve static content from subdirectories of your home directory: </para><screen><![CDATA[dom "yourdomain" with
  simpleWeb "site1" "sites/site1";
  (* This creates a web virtual host site1.yourdomain, serving content from ~/sites/site1. *)
  simpleWeb "site2" "sites/site2";
end]]></screen></section><section><title>The Model T</title><para>Now we come to the <code>web</code> directive, which should be your main tool for creating additional virtual vhosts with custom configuration. </para><screen><![CDATA[dom "yourdomain" with
  web "mywebhost" with
    (* This is a web host found at mywebhost.yourdomain. *)
  end;
end;]]></screen><para>Note that the <code>web</code> directive also adds the right DNS mapping for your virtual host.  <emphasis role="strong">Never use <code>web &quot;www&quot;</code> within a <code>dom</code> directive.</emphasis>  Instead, see the examples at the beginning of the Apache section.  All of the directives demonstrated in the rest of the Apache section can be used between the <code>begin</code> and <code>end</code> demonstrated in that example. </para></section><section><title>The Do-It-Yourself</title><screen><![CDATA[dom "yourdomain" with
  vhost "mywebhost" with
  end;
end;]]></screen><para>This one doesn't add any DNS mappings.   <emphasis role="strong">You probably never want to use <code>vhost</code> instead of <code>web</code>.</emphasis> </para></section><section><title>The Top-Level Do-It-Yourself</title><para>The same can also be done to create a vhost accessible via <code>http://yourdomain/</code>. </para><screen><![CDATA[dom "yourdomain" with
  vhostDefault with
  end;
end;]]></screen></section><section><title>Using a nonstandard web server</title><screen><![CDATA[dom "yourdomain" with
  web "mywebhost" where
    WebPlaces = [web_place_default "fyodor"]
  with
  end;
end;]]></screen></section><section><title>Using SSL (HTTPS)</title><para>For this example, we assume that you've applied for and been granted permissions on the SSL certificate <code>/etc/apache2/ssl/user/yourdomain.pem</code>. </para><screen><![CDATA[dom "yourdomain.com" where
  CreateWWW = false;
with
  web "www" where
    SSL = use_cert "/etc/apache2/ssl/user/yourdomain.pem"
  with
  end;
end;]]></screen></section><section><title>Allowing non-secure &amp; secure connection with same behaviour</title><para>If you want to enable ssl and force a redirect from http to https, the <code>webSsl</code> directive can handle this for you in most cases. </para><para>The example below is stripped of all extra settings on the &quot;www&quot; web directive. If you have any special settings, they should be copied as well. </para><screen><![CDATA[dom "yourdomain.com" where
  CreateWWW = false;
  DocumentRoot = home "websites/yourdomain.com"
with
  webSsl "www" (use_cert "/etc/apache2/ssl/user/yourdomain.pem") with
  end;
end;]]></screen><para>If you want to allow both http and https with the same configuration instead, you can set the <code>ForceSSL</code> environment variable to false. </para><screen><![CDATA[dom "yourdomain.com" where
  CreateWWW = false;
  DocumentRoot = home "websites/yourdomain.com"
with
  webSsl "www" (use_cert "/etc/apache2/ssl/user/yourdomain.pem") where
    ForceSSL = false
  with
  end;
end;]]></screen></section><section><title>Bucking all the trends</title><screen><![CDATA[dom "yourdomain" with
  web "mywebhost" where
    DocumentRoot = home "private_html";
    User = "me_web";
    Group = "me_web";
    SSL = use_cert "/home/me/mycert.pem"
  with
  end;
end;]]></screen><para><code>home &quot;private_html&quot;</code> builds the full path to subdirectory <code>private_html</code> of your home directory. </para></section><section><title>Basic URL handling</title><screen><![CDATA[dom "yourdomain" with
  web "mywebhost" with
    alias "/doc" "/usr/local/doc";
    (* Serve all URIs beginning in /doc out of directory /usr/local/doc.
       Note that the second argument can't be just any old path.  You need to have
       been granted permission to read from the path.  You should have permission
       to read from any path within your home directory, as well as a few others,
       like /usr/share/moin. *)
    scriptAlias "/my-script" "/var/cgi/a-program";
    (* Handle requests for /my-script by calling the CGI program /var/cgi/a-program.
       The example here uses a file, but scriptAlias directive can also alias CGI
       directories, as you'd expect: scriptAlias "/location/" "/directory/" *)
    errorDocument "404" "not_found.html";
    (* Handle HTTP error code 404 by sending file not_found.html *)
  end;
end;]]></screen></section><section><title>Location-specific configuration</title><screen><![CDATA[dom "yourdomain" with
  web "mywebhost" with
    location "/private" with
       errorDocument "404" "not_found_private.html";
    end;
    (* When in the /private tree of URI-space, handle 404s with not_found_private.html *)
    directory "/usr/local/doc" with
       errorDocument "404" "not_found_doc.html";
    end;
    (* When looking for a file in real directory /usr/local/doc, handle 404s with not_found_doc.html *)
    location "/cgi-bin" with
       options [execCGI];
       cgiExtension "cgi"
    end;
    (* Any path like /cgi-bin/*.cgi should be executed as a CGI script. *)
  end;
end;]]></screen></section><section><title>Server aliases</title><screen><![CDATA[dom "yourdomain" with
  web "mywebhost" with
    serverAliasHost "www2.yourdomain";
    serverAliasHost "www.otherdomain";
    (* www2.yourdomain and www.otherdomain are alternate names for this vhost *)
    serverAlias "www3";
    (* Short form for an alternate name within the current domain *)
    serverAliasDefault;
    (* Make this virtual host answer to yourdomain, with no extra hostname needed in front. *)
  end;
end;]]></screen><para>Note that you must have Domtool configuration rights to all domains you name with <code>serverAlias</code>.  See the example &quot;Attack of the Model T Clones&quot; for a more convenient way of duplicating all of a domain's configuration for one or more other domains. </para></section><section><title>Directory options</title><screen><![CDATA[dom "yourdomain" with
  web "mywebhost" with
    options [execCGI, indexes];
    (* Use exactly the Apache options execCGI and indexes by default for this vhost *)
    set_options [includesNOEXEC];
    (* Add the option includesNOEXEC, leaving the others alone *)
    unset_options [followSymLinks];
    (* Ask not to follow symbolic links. *)
    directoryIndex ["index.html", "index.php", "index.txt"];
    (* When looking for the default file to serve for a directory, consider these possibilities in order *)
    action "image/gif" "/cgi-bin/images.cgi";
    (* Run /cgi-bin/images.cgi to serve images *)
    addDefaultCharset "utf-8";
    (* Use the UTF-8 character set by default *)
    location "/prefix" with
       forceType "text/plain";
       (* Serve all files in this location as plain text *)
       forceTypeOff;
       (* Change our mind about that! *)
       (* All the other directives mentioned above can be used in locations, too, but forceType* _must_ be in a location. *)
    end;
  end;
end;]]></screen></section><section><title>Access control</title><screen><![CDATA[dom "yourdomain" with
  web "mywebhost" with
    location "/loc1" with
      authType basic;
      (* Use HTTP basic authentication in this location *)
      authName "my domain";
      (* Tell users that they're authenticating for "my domain" *)
      authUserFile "/etc/webusers";
      (* Look up user/password information in /etc/webusers *)
      orderAllowDeny;
      (* Access is denied by default *)
      requireValidUser;
      (* Anyone providing a valid password is allowed *)
      denyFrom "badguys.evil.net";
      (* However, anyone coming from this domain is banned *)
      denyFrom "1.2";
      (* Also ban anyone with a 1.2.*.* IP address *)
    end;
    location "/loc2" with
       authType basic;
       authName "my other domain";
       authUserFile "/etc/otherone";
       denyFromAll;
       (* Deny everyone by default *)
       requireUser ["fred", "barney"];
       (* Allow fred and barney in *)
       requireGroup ["prehistoric"];
       (* Also require membership in the prehistoric group *)
    end;
  end;
end]]></screen></section><section><title>Fancy directory index generation</title><screen><![CDATA[dom "yourdomain" with
  web "mywebhost" with
    addDescription "The planet Mars" "/web/pics/mars.gif";
    (* Describe /web/pics/mars.gif as "The planet Mars" on index pages *)
    indexOptions [fancyIndexing, htmlTable, iconHeight 10, iconWidth 10];
    (* Set some index-generation options *)
    headerName "header.html";
    (* Include header.html at the start of a directory listing *)
    footerName "footer.html";
    (* Include footer.html at the end of a directory listing *)
  end;
end;]]></screen></section><section><title>mod_rewrite</title><screen><![CDATA[dom "yourdomain" with
  web "mywebhost" with
    rewriteRule "^(.+)\.php$" "$1.sml" [];
    (* Rewrite all URLs ending in .php to end in .sml *)
    rewriteRule "/gone.html" "http://somewhere.else/there.html" [redirectWith permanent];
    (* Redirect /gone.html to http://somewhere.else/there.html, giving an HTTP code indicating a permanent relocation *)
    rewriteLogLevel 1;
    (* Turn on some more logging for rewrite debugging in /afs/hcoop.net/usr/$USER/apache/log/$NODE/www.yourdomain/error.log *)
    rewriteCond "%{REQUEST_FILENAME}" "-f" [cond_nocase, ornext];
    (* An example of Apache's RewriteCond directive *)
    rewriteRule "/a.html" "http://a/b.html" [gone, chain, skip 5];
    (* An example of specifying multiple rewrite flags *)
  end;
end;]]></screen></section><section><title>mod_proxy</title><screen><![CDATA[dom "yourdomain" with
  web "mywebhost" with
    proxyPass "/mirror/foo/" "http://localhost:5555/";
    (* Proxy path /mirror/foo/ to a local server with URL base http://localhost:5555/ *)
    proxyPassReverse "/mirror/foo/" "http://localhost:5555/";
    (* Adjust Location and other HTTP headers appropriately for the above proxying *)
    proxyRewrite "/foo/(.*)$" "bar/$1" "http://localhost:5555" [qsappend];
    (* Proxy path matching /foo/(.*)$ to http://localhost:5555/bar/$1, using mod_rewrite *)
    proxyPassReverse "/foo/" "http://localhost:5555/";
    (* Adjust Location and other HTTP headers appropriately for the above proxying *)
  end;
end;]]></screen></section><section><title>SSI</title><screen><![CDATA[dom "yourdomain" with
  web "mywebhost" with
    set_options [includesNOEXEC];
]]><![CDATA[
    (* Or you could enable it for just some URIs: *)
    location "/ssi_world" with
      set_options [includesNOEXEC];
    end;
  end;
end;]]></screen></section></section><section><title>Mailman</title><para>The following example will: </para><itemizedlist><listitem><para>Permit delivery of email of the form LIST@yourdomain to Mailman, provided that LIST is a valid Mailman list that you own. </para></listitem><listitem><para>Set up a web interface at <code>http://lists.yourdomain/listinfo</code>, which contains a general overview of the lists that you own and permits you to administer them. </para></listitem><listitem><para>Add a valid DNS mapping for lists.yourdomain. </para></listitem></itemizedlist><screen><![CDATA[dom "yourdomain" with
  mailman "lists";
  (* The default server for web interfaces to this domain's mailing lists is lists.yourdomain *)
end;]]></screen></section><section><title>Common Web Applications</title><section><title>MoinMoin</title><section><title>A Standalone Site</title><screen><![CDATA[dom "yourdomain" with
  moinMoin "mywiki" where
    Script = home "mywiki/moin.cgi"
  with
  end
end]]></screen></section><section><title>Adding a Wiki to a Bigger Site</title><screen><![CDATA[dom "yourdomain" with
  web "mysite" with
    (* Other normal web config goes here.... *)
    addMoinMoin where
      Script = home "mywiki/moin.cgi";
      Htdocs = "/where/static/content/is/accessed/in/URLs";
      Prefix = "/url/prefix/for/wiki/page/names"
    end
  end
end]]></screen></section></section><section><title>WordPress</title><para>When installing Wordpress, you most likely want to <ulink url="http://codex.wordpress.org/Installing/Updating_WordPress_with_Subversion">install using subversion</ulink>. The web based updater is inherently insecure, and your life will be much easier if you use subversion to track changes in Wordpress. </para><section><title>A Standalone Blog</title><screen><![CDATA[dom "yourdomain" with
  wordPress "myblog" where
    DocumentRoot = home "path/to/wordpress"
  end
  (* Creates a WordPress blog at http://myblog.yourdomain/ *)
end]]></screen><para>Make sure you have the WordPress distribution installed at the appropriate <code>DocumentRoot</code>. </para></section><section><title>If the Blog is Your Entire Site</title><screen><![CDATA[dom "yourdomain.com" where
  DocumentRoot = home "path/to/wordpress";
  WWW = begin
    addWordPress "/";
  end;
  (* Creates a WordPress blog at http://www.yourdomain.com/ *)
with end;]]></screen><para>Again, make sure you have the WordPress distribution installed at the appropriate <code>DocumentRoot</code>. </para></section><section><title>Adding a Blog to a Bigger Site</title><screen><![CDATA[dom "yourdomain" with
  web "mysite" with
    (* Other normal web config goes here.... *)
    addWordPress "/url/prefix"
  end
end]]></screen><para>Make sure you have the WordPress distribution installed at the filesystem location implied by the URL prefix you choose.  Your blog will be accessible at <code>http://mysite.yourdomain/url/prefix/...</code>. </para></section></section></section><section><title>Live Examples in HCoop AFS</title><para>This is a listing of some of the files in the HCoop AFS area which contain in-production examples of <ulink url="https://wiki.hcoop.net/DomTool/Examples/DomTool#">DomTool</ulink> configuration. </para><itemizedlist><listitem><para>/afs/hcoop.net/user/d/do/docelic/.domtool/spinlocksolutions.com </para></listitem></itemizedlist><para>To find other files and possibly grep for particular examples in them, you can use the following shell commands: </para><screen><![CDATA[cd /afs/hcoop.net/user/
]]><![CDATA[
find ?/??/*/.domtool/ -type f
# or
find ?/??/*/.domtool/ -type f \( ! -iname "*~" \)  2> /dev/null | xargs -I {} wc -l {}  | sort -n
]]><![CDATA[
grep KEYWORD ?/??/*/.domtool/*]]></screen></section><section><title>Putting It All Together</title><para>In order to help you put all of the pieces together, some full working examples are available in <ulink url="https://wiki.hcoop.net/DomTool/Examples/DomTool/Examples/Full#">separate subpage</ulink>. </para><!--rule (<hr>) is not applicable to DocBook--><para> <ulink url="https://wiki.hcoop.net/DomTool/Examples/CategoryMemberManual#">CategoryMemberManual</ulink> </para></section></article>