From cac6c3f6f0c2e00207accfd82a4611aa7a6c135c Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Fri, 21 Mar 2014 09:33:38 +0100 Subject: Add httpd props file and a READM explaining this. --- src/tools/README | 53 ++++++++++++++++++++++++++++++++++++++++ src/tools/httpd_config | 10 -------- src/tools/httpd_config.OFF | 9 +++++++ src/tools/httpd_inets.config | 4 +-- src/tools/httpd_inets_props.conf | 25 +++++++++++++++++++ 5 files changed, 89 insertions(+), 12 deletions(-) create mode 100644 src/tools/README delete mode 100644 src/tools/httpd_config create mode 100644 src/tools/httpd_config.OFF create mode 100644 src/tools/httpd_inets_props.conf diff --git a/src/tools/README b/src/tools/README new file mode 100644 index 0000000..b59a277 --- /dev/null +++ b/src/tools/README @@ -0,0 +1,53 @@ +* httpd with ssl + +Run httpd using inets. Tell inets what to start by configuring +'services' in a config file that you pass to erl(1) at startup: + +$ cat httpd_inets.config +[{inets, [{services, [ + {httpd, [{proplist_file, "httpd_inets_props.conf"}]} + ]}]}]. +$ + +Then start erl with `-config httpd_inets'. +In erl, start inets: + +1> inets.start(). +ok + +There are two ways to configure the httpd server. + +Either configure httpd using a props list with all the httpd arguments: + +$ cat httpd_inets_props.conf +[ + {port, 8080}, + {bind_address, {127,0,0,1}}, + {server_name, "httpd_inets_FQDN"}, + {server_root, "/tmp/httpd_inets"}, + {document_root, "/tmp/httpd_inets/docroot"}, + {socket_type, essl}, + {ssl_certificate_file, "/tmp/httpd_inets/02.pem"}, + {ssl_certificate_key_file, "/tmp/httpd_inets/srv1.key"}, + {ssl_ca_certificate_file, "/tmp/httpd_inets/01.pem"} +]. +$ + +In the example config for inets above, this is what will be used. + +Or configure httpd using an Apache like configuration file. Configure +inets to start httpd with {file, "httpd_config"} in +httpd_inets.config. Here's a config file equivalent to what's seen +above in the props list: + +$ cat httpd_config.OFF +ServerName httpd_inets_FQDN +ServerRoot /tmp/httpd_inets +DocumentRoot /tmp/httpd_inets/docroot +Port 8080 +SocketType essl + +SSLCertificateFile /tmp/httpd_inets/02.pem +SSLCertificateKeyFile /tmp/httpd_inets/srv1.key +SSLCACertificateFile /tmp/httpd_inets/01.pem +$ diff --git a/src/tools/httpd_config b/src/tools/httpd_config deleted file mode 100644 index 8dc9238..0000000 --- a/src/tools/httpd_config +++ /dev/null @@ -1,10 +0,0 @@ -ServerName httpd_inets_FQDN -ServerRoot /tmp/httpd_inets -DocumentRoot /tmp/httpd_inets/docroot -Port 8080 -SocketType essl - -SSLCertificateFile /tmp/httpd_inets/02.pem -SSLCertificateKeyFile /tmp/httpd_inets/srv1.key -SSLCACertificateFile /tmp/httpd_inets/01.pem - diff --git a/src/tools/httpd_config.OFF b/src/tools/httpd_config.OFF new file mode 100644 index 0000000..5a75648 --- /dev/null +++ b/src/tools/httpd_config.OFF @@ -0,0 +1,9 @@ +ServerName httpd_inets_FQDN +ServerRoot /tmp/httpd_inets +DocumentRoot /tmp/httpd_inets/docroot +Port 8080 +SocketType essl + +SSLCertificateFile /tmp/httpd_inets/02.pem +SSLCertificateKeyFile /tmp/httpd_inets/srv1.key +SSLCACertificateFile /tmp/httpd_inets/01.pem diff --git a/src/tools/httpd_inets.config b/src/tools/httpd_inets.config index aa3abf3..7baa8ef 100644 --- a/src/tools/httpd_inets.config +++ b/src/tools/httpd_inets.config @@ -26,6 +26,6 @@ %% 5> %% [{inets, [{services, [ - %%{httpd, [{proplist_file, "httpd_inets_props.conf"}]}, - {httpd, [{file, "httpd_config"}]} + {httpd, [{proplist_file, "httpd_inets_props.conf"}]} + %%{httpd, [{file, "httpd_config"}]} ]}]}]. diff --git a/src/tools/httpd_inets_props.conf b/src/tools/httpd_inets_props.conf new file mode 100644 index 0000000..feffe8a --- /dev/null +++ b/src/tools/httpd_inets_props.conf @@ -0,0 +1,25 @@ +[ + {port, 8080}, + {bind_address, {127,0,0,1}}, + {server_name, "httpd_inets_FQDN"}, + {server_root, "/tmp/httpd_inets"}, + {document_root, "/tmp/httpd_inets/docroot"}, + {socket_type, essl}, + {ssl_certificate_file, "/tmp/httpd_inets/02.pem"}, + {ssl_certificate_key_file, "/tmp/httpd_inets/srv1.key"}, + {ssl_ca_certificate_file, "/tmp/httpd_inets/01.pem"} +]. + + + %% {socket_type, {essl, [ + %% {certfile, "/tmp/httpd_inets/02.pem"}, + %% {keyfile, "/tmp/httpd_inets/srv1.key"}, + %% {cacertfile, "/tmp/httpd_inets/01.pem"}, + %% {verify, 0} + %% ]}} + +%% {ssl_certificate_file, "02.pem"}, +%% {ssl_certificate_key_file, "srv1.key"}, +%% {ssl_ca_certificate_file, "01.pem"} + +%% FIXME: limit modules {modules, [mod_get, mod_log] -- cgit v1.1