Much of this came from this stackoverflow question. I've almost copied it completely except for a few details below.
Here is a complete configuration file example. (8080.conf)
[
{modules, [
mod_alias,
mod_auth,
mod_esi,
mod_actions,
mod_cgi,
mod_dir,
mod_get,
mod_head,
mod_log,
mod_disk_log
]},
{port,8080},
{server_name,"localhost.localdomain"},
{server_root,"log"},
{document_root,"www"},
{erl_script_alias, {"/test", [test]}},
{error_log, "error.log"},
{security_log, "security.log"},
{transfer_log, "transfer.log"},
{mime_types,[
{"html","text/html"},
{"css","text/css"},
{"js","application/x-javascript"}
]}
].
Here is how to start inets using the configuration file.
inets:start(),
inets:start(httpd, [{proplist_file, "8080.conf"}]). Make sure that both "www" and "log" directories are there otherwise it won't work either. If you put a test file in the "www" directory, opening http://localhost:8080/test.html will download it.
A few things didn't work, so I wouldn't bother trying this
- Trying to add extra configuration items before or after proplist_file when calling inets:start. I tried to specify the port dynamically in this fashion, but it didn't work. Looking at the source might help me work out why.
- Switching port 8080 to a port < 1024. Linux doesn't let you do this without some extra trickery. I'm investigating how to get around this.
No comments:
Post a Comment