From d883acf9749bb2f304570b74509d8399bd91604b Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Fri, 21 Mar 2014 11:44:05 +0100 Subject: Add info about mod_esi. --- src/tools/README | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/tools/README b/src/tools/README index b59a277..3db5c00 100644 --- a/src/tools/README +++ b/src/tools/README @@ -1,5 +1,5 @@ -* httpd with ssl - +* httpd +** 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: @@ -51,3 +51,35 @@ SSLCertificateFile /tmp/httpd_inets/02.pem SSLCertificateKeyFile /tmp/httpd_inets/srv1.key SSLCACertificateFile /tmp/httpd_inets/01.pem $ +** dynamic content +Configuring httpd with {erl_script_alias, {"/d", [httpd_inets]}} and +compiling httpd_inets.erl will make the following URL refer to +httpd_inets:hello/3: + + https://localhost:8080/d/httpd_inets:hello + +Here's an example of what http_inets.erl can look like: + +$ cat httpd_inets.erl +-module('httpd_inets'). +-export([hello/3]). + +hello(SessionID, _Env, _Input) -> + mod_esi:deliver(SessionID, [ + "Content-Type: text/html\r\n\r\n", + "hello, erlang world" + ]). +$ + +httpd config 'modules' seems to be crucial to get right, including the +order of the modules listed. The mod_esi module is the one providing +the erl_script_alias functionality. Here's a configuration that's +working with Erlang R15B01 (erts-5.9.1): + + {modules, [mod_alias, + mod_auth, + mod_esi, + mod_get, + mod_head, + mod_log, + mod_disk_log]}, -- cgit v1.1