diff --git a/lib/core/context.c b/lib/core/context.c
index c7df2628a21d6182da8981346bba925f9fb4178f..34d5346caac3d4dd6fbcc12c67c97fd965ec0da7 100644
--- a/lib/core/context.c
+++ b/lib/core/context.c
@@ -877,7 +877,7 @@ lws_create_vhost(struct lws_context *context,
 #endif
 
 #ifdef LWS_WITH_UNIX_SOCK
-	if (LWS_UNIX_SOCK_ENABLED(context)) {
+	if (LWS_UNIX_SOCK_ENABLED(vh)) {
 		lwsl_notice("Creating Vhost '%s' path \"%s\", %d protocols\n",
 				vh->name, vh->iface, vh->count_protocols);
 	} else
@@ -1424,16 +1424,17 @@ lws_create_context(const struct lws_context_creation_info *info)
 		return NULL;
 	}
 
-
 #if defined(LWS_WITH_PEER_LIMITS)
 	/* scale the peer hash table according to the max fds for the process,
 	 * so that the max list depth averages 16.  Eg, 1024 fd -> 64,
 	 * 102400 fd -> 6400
 	 */
+
 	context->pl_hash_elements =
 		(context->count_threads * context->fd_limit_per_thread) / 16;
 	context->pl_hash_table = lws_zalloc(sizeof(struct lws_peer *) *
 			context->pl_hash_elements, "peer limits hash table");
+
 	context->ip_limit_ah = info->ip_limit_ah;
 	context->ip_limit_wsi = info->ip_limit_wsi;
 #endif
@@ -1812,7 +1813,7 @@ __lws_vhost_destroy2(struct lws_vhost *vh)
 #endif
 
 #if defined(LWS_WITH_UNIX_SOCK)
-	if (LWS_UNIX_SOCK_ENABLED(context)) {
+	if (LWS_UNIX_SOCK_ENABLED(vh)) {
 		n = unlink(vh->iface);
 		if (n)
 			lwsl_info("Closing unix socket %s: errno %d\n",
diff --git a/lib/core/libwebsockets.c b/lib/core/libwebsockets.c
index 413bddffb5b2f6b188513303a93a9a432d4548ec..de93251771dc43d7dcf71183c6bbf8892362e137 100644
--- a/lib/core/libwebsockets.c
+++ b/lib/core/libwebsockets.c
@@ -2488,7 +2488,7 @@ lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port,
 	struct sockaddr_storage sin;
 	struct sockaddr *v;
 
-#ifdef LWS_WITH_UNIX_SOCK
+#if defined(LWS_WITH_UNIX_SOCK)
 	if (LWS_UNIX_SOCK_ENABLED(vhost)) {
 		v = (struct sockaddr *)&serv_unix;
 		n = sizeof(struct sockaddr_un);
@@ -2504,6 +2504,8 @@ lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port,
 		strcpy(serv_unix.sun_path, iface);
 		if (serv_unix.sun_path[0] == '@')
 			serv_unix.sun_path[0] = '\0';
+		else
+			unlink(serv_unix.sun_path);
 
 	} else
 #endif
@@ -2566,7 +2568,7 @@ lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port,
 #ifdef LWS_WITH_UNIX_SOCK
 	if (n < 0 && LWS_UNIX_SOCK_ENABLED(vhost)) {
 		lwsl_err("ERROR on binding fd %d to \"%s\" (%d %d)\n",
-				sockfd, iface, n, LWS_ERRNO);
+			 sockfd, iface, n, LWS_ERRNO);
 		return -1;
 	} else
 #endif
@@ -2576,6 +2578,12 @@ lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port,
 		return -1;
 	}
 
+#if defined(LWS_WITH_UNIX_SOCK)
+	if (LWS_UNIX_SOCK_ENABLED(vhost) && vhost->context->uid) {
+		chown(serv_unix.sun_path, vhost->context->uid, vhost->context->gid);
+	}
+#endif
+
 #ifndef LWS_PLAT_OPTEE
 	if (getsockname(sockfd, (struct sockaddr *)&sin, &len) == -1)
 		lwsl_warn("getsockname: %s\n", strerror(LWS_ERRNO));
diff --git a/lib/misc/peer-limits.c b/lib/misc/peer-limits.c
index 1f1ef4d3e0ad2617ac9f79c092c6a58e6f40aaec..8ccf3fdb55edff06cf9af007e4c2487313b9c3e3 100644
--- a/lib/misc/peer-limits.c
+++ b/lib/misc/peer-limits.c
@@ -64,6 +64,9 @@ lws_get_or_create_peer(struct lws_vhost *vhost, lws_sockfd_type sockfd)
 	int n, af = AF_INET;
 	struct sockaddr_storage addr;
 
+	if (vhost->options & LWS_SERVER_OPTION_UNIX_SOCK)
+		return NULL;
+
 #ifdef LWS_WITH_IPV6
 	if (LWS_IPV6_ENABLED(vhost)) {
 		af = AF_INET6;
diff --git a/lib/plat/unix/unix-init.c b/lib/plat/unix/unix-init.c
index a71718e7cee64d5513f062cce4baae2a09734010..fa9a30e8d2c3f11ed93bed4b5ef7ecfd9362e659 100644
--- a/lib/plat/unix/unix-init.c
+++ b/lib/plat/unix/unix-init.c
@@ -57,7 +57,7 @@ lws_plat_init(struct lws_context *context,
 	}
 
 #ifdef LWS_WITH_PLUGINS
-	if (info->plugin_dirs)
+	if (info->plugin_dirs && (context->options & LWS_SERVER_OPTION_LIBUV))
 		lws_plat_plugins_init(context, info->plugin_dirs);
 #endif
 
diff --git a/lib/roles/http/server/lejp-conf.c b/lib/roles/http/server/lejp-conf.c
index f9ac68a5403797df6c3f0b9a6ad1f0d16d39a888..dc49bf61ffb6f3208af117ddb714ca74ed00d5bc 100644
--- a/lib/roles/http/server/lejp-conf.c
+++ b/lib/roles/http/server/lejp-conf.c
@@ -1,7 +1,7 @@
 /*
  * libwebsockets web server application
  *
- * Copyright (C) 2010-2017 Andy Green <andy@warmcat.com>
+ * Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -442,8 +442,9 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
 		struct lws_vhost *vhost;
 
 		//lwsl_notice("%s\n", ctx->path);
-		if (!a->info->port) {
-			lwsl_err("Port required (eg, 443)");
+		if (!a->info->port &&
+		    !(a->info->options & LWS_SERVER_OPTION_UNIX_SOCK)) {
+			lwsl_err("Port required (eg, 443)\n");
 			return 1;
 		}
 		a->valid = 0;