summaryrefslogtreecommitdiff
path: root/src/https_server.erl
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2014-05-04 19:52:13 +0200
committerLinus Nordberg <linus@nordberg.se>2014-05-04 19:52:13 +0200
commited8bb6d1e454b9ddc793f74f682bd80b1c728904 (patch)
treeae81a24c1e7bbafd0a169ef94d8fada9d9403408 /src/https_server.erl
parent68f6bdf0f88322867b35a6ae35a0c4c3ea641884 (diff)
Get going, first cut.
add-chain looks like it might work properly. Not verified!
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).