andalso SS.exists (fn s' => path = s' orelse String.isPrefix (s' ^ "/") path) (your_paths ())
fun yourDomainHost s =
- let
+ yourDomain s
+ orelse let
val (pref, suf) = Substring.splitl (fn ch => ch <> #".") (Substring.full s)
in
Substring.size suf > 0
andalso validHost (Substring.string pref)
andalso yourDomain (Substring.string
- (Substring.slice (suf, 1, NONE)))
+ (Substring.slice (suf, 1, NONE)))
end
fun validUser s = size s > 0 andalso size s < 20
fun write s = app (fn file => TextIO.output (file, s)) (!vhostFiles)
val rewriteEnabled = ref false
+val currentVhost = ref ""
+val currentVhostId = ref ""
val () = Env.containerV_one "vhost"
("host", Env.string)
val sadmin = Env.env Env.string (env, "ServerAdmin")
val fullHost = host ^ "." ^ Domain.currentDomain ()
+ val vhostId = fullHost ^ (if ssl then ".ssl" else "")
val confFile = fullHost ^ (if ssl then ".vhost_ssl" else ".vhost")
in
+ currentVhost := fullHost;
+ currentVhostId := vhostId;
+
rewriteEnabled := false;
vhostFiles := map (fn node =>
let
write docroot;
write "\n\tServerAdmin ";
write sadmin;
- write "\n"
+ write "\n\tErrorLog ";
+ write Config.Apache.logDir;
+ write "/";
+ write vhostId;
+ write "/error.log\n\tCustomLog ";
+ write Config.Apache.logDir;
+ write "/";
+ write vhostId;
+ write "/access.log combined\n"
end,
fn () => (write "</VirtualHost>\n";
app TextIO.closeOut (!vhostFiles)))
write "]");
write "\n"))
+val () = Env.action_one "rewriteLogLevel"
+ ("level", Env.int)
+ (fn level =>
+ (checkRewrite ();
+ write "\tRewriteLog ";
+ write Config.Apache.logDir;
+ write "/";
+ write (!currentVhostId);
+ write "/rewrite.log\n\tRewriteLogLevel ";
+ write (Int.toString level);
+ write "\n"))
+
val () = Env.action_two "alias"
("from", Env.string, "to", Env.string)
(fn (from, to) =>
DocumentRoot = "/home/adamc/html";
ServerAdmin = "adamc@hcoop.net"
with
+ serverAlias "hcoop.net";
addDefaultCharset "mumbo-jumbo/incomprehensible"
end;
rewriteCond "hi" "there" [ornext];
rewriteRule "^/foo.html" "/bar.html" [redirectWith redir300, nosubreq];
+ rewriteLogLevel 2;
+
location "/theMorgue" with
rewriteRule "A" "B" [];
end
vhost "lists" with
proxyPass "/mailman" "http://hcoop.net/cgi-bin/mailman";
+ proxyPass "/pipermail" "http://hcoop.net/pipermail";
alias "/doc/mailman" "/home/adamc/mailman";
location "/the-citadel" with