lwsws conf move interface to be vhost attribute

Signed-off-by: Andy Green <andy@warmcat.com>
This commit is contained in:
Andy Green 2016-04-14 11:50:05 +08:00
parent cc3c6fb047
commit 1042b34127
2 changed files with 11 additions and 10 deletions

View file

@ -28,9 +28,8 @@ There is a single file intended for global settings
{
"global": {
"uid": "48",
"gid": "48",
"interface": "eth0",
"uid": "48", # apache user
"gid": "48", # apache user
"count-threads": "1",
"init-ssl": "yes"
}
@ -46,10 +45,11 @@ and a config directory intended to take one file per vhost
"vhosts": [{
"name": "warmcat.com",
"port": "443",
"host-ssl-key": "/etc/pki/tls/private/warmcat.com.key",
"interface": "eth0", # optional
"host-ssl-key": "/etc/pki/tls/private/warmcat.com.key", # if given enable ssl
"host-ssl-cert": "/etc/pki/tls/certs/warmcat.com.crt",
"host-ssl-ca": "/etc/pki/tls/certs/warmcat.com.cer",
"mounts": [{
"mounts": [{ # autoserve
"mountpoint": "/",
"origin": "file:///var/www/warmcat.com",
"default": "index.html"
@ -161,6 +161,7 @@ Other vhost options
- keeplive-timeout (in secs) defaults to 60 for lwsws, it may be set as a vhost option
- `interface` lets you specify which network interface to listen on, if not given listens on all
Mounts
------

View file

@ -24,7 +24,6 @@
static const char * const paths_global[] = {
"global.uid",
"global.gid",
"global.interface",
"global.count-threads",
"global.init-ssl",
};
@ -32,7 +31,6 @@ static const char * const paths_global[] = {
enum lejp_global_paths {
LEJPGP_UID,
LEJPGP_GID,
LEJPGP_INTERFACE,
LEJPGP_COUNT_THREADS,
LWJPGP_INIT_SSL,
};
@ -42,6 +40,7 @@ static const char * const paths_vhosts[] = {
"vhosts[].mounts[]",
"vhosts[].name",
"vhosts[].port",
"vhosts[].interface",
"vhosts[].host-ssl-key",
"vhosts[].host-ssl-cert",
"vhosts[].host-ssl-ca",
@ -61,6 +60,7 @@ enum lejp_vhost_paths {
LEJPVP_MOUNTS,
LEJPVP_NAME,
LEJPVP_PORT,
LEJPVP_INTERFACE,
LEJPVP_HOST_SSL_KEY,
LEJPVP_HOST_SSL_CERT,
LEJPVP_HOST_SSL_CA,
@ -128,9 +128,6 @@ lejp_globals_cb(struct lejp_ctx *ctx, char reason)
case LEJPGP_GID:
a->info->gid = atoi(ctx->buf);
return 0;
case LEJPGP_INTERFACE:
a->info->iface = a->p;
break;
case LEJPGP_COUNT_THREADS:
a->info->count_threads = atoi(ctx->buf);
return 0;
@ -270,6 +267,9 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
case LEJPVP_PORT:
a->info->port = atoi(ctx->buf);
return 0;
case LEJPVP_INTERFACE:
a->info->iface = a->p;
break;
case LEJPVP_HOST_SSL_KEY:
a->info->ssl_private_key_filepath = a->p;
break;