summaryrefslogtreecommitdiff
path: root/src/https_server.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/https_server.erl')
-rw-r--r--src/https_server.erl43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/https_server.erl b/src/https_server.erl
new file mode 100644
index 0000000..a0b81b4
--- /dev/null
+++ b/src/https_server.erl
@@ -0,0 +1,43 @@
+-module(https_server).
+-export([start/0, stop/1]).
+
+start() ->
+ io:format("Starting https server~n"),
+ %% TODO: put this in httpd_props.conf and use that at erlang
+ %% start. inets:start(httpd, {proplist_file, "httpd_props.conf"}).
+ ServerRoot = "/home/linus/usr/src/ct/ctls/webroot",
+ {ok, Pid} =
+ inets:start(httpd,
+ [{port, 8080},
+ %%{bind_address, {127,0,0,1}},
+ {bind_address, {192, 168, 122, 119}},
+ {server_name, "flimsy.ct.nordu.net"},
+ {server_root, ServerRoot},
+ {document_root, ServerRoot ++ "/docroot"},
+ {modules, [mod_alias,
+ mod_auth,
+ mod_esi,
+ mod_get,
+ mod_head,
+ mod_log,
+ mod_disk_log]},
+ %%{re_write, {"^/ct/v1/(.*)$", "/ct/v1/https_server/\\1"}},
+ {re_write, {"^/ct/v1/(.*)_(.*)$", "/ct/v1/\\1-\\2"}},
+ {erl_script_alias, {"/ct", [v1]}},
+ {erl_script_nocache, true},
+ {error_log, "log/error"},
+ {security_log, "log/security"},
+ {transfer_log, "log/transfer"},
+ %% See ssl(3erl) for SSL options.
+ {socket_type, {essl, [
+ {certfile, ServerRoot ++ "/certs/webcert.pem"},
+ {keyfile, ServerRoot ++ "/keys/webkey.pem"},
+ %%{cacertfile, ServerRoot ++ "/certs/cacert.pem"},
+ {ciphers, ssl:cipher_suites()},
+ {verify, verify_none}
+ ]}}
+ ]),
+ Pid.
+
+stop(Pid) ->
+ inets:stop(httpd, Pid).