--- ./src/server.c	2018-03-12 00:52:20.000000000 +0100
+++ ./src/server.c	2018-04-03 10:40:28.711338800 +0200
@@ -85,6 +85,14 @@
 /* #define USE_ALARM */
 #endif
 
+#ifdef __CYGWIN__
+/* Cygwin 'nodosfilewarning' fix */
+static int disable_cygpathwarn(void) {
+	setenv("CYGWIN", "nodosfilewarning", 1);
+	return -1;
+}
+#endif
+
 static int oneshot_fd = 0;
 static volatile int pid_fd = -2;
 static server_socket_array graceful_sockets;
@@ -279,7 +287,12 @@
 	force_assert(srv->fdwaitqueue);
 
 	srv->srvconf.modules = array_init();
+#ifdef __CYGWIN__
+	/* Modify default module directory */
+	srv->srvconf.modules_dir = buffer_init_string("modules");
+#else
 	srv->srvconf.modules_dir = buffer_init_string(LIBRARY_DIR);
+#endif
 	srv->srvconf.network_backend = buffer_init();
 	srv->srvconf.upload_tempdirs = array_init();
 	srv->srvconf.reject_expect_100_with_417 = 1;
@@ -519,6 +532,10 @@
 #ifdef NONREPRODUCIBLE_BUILD
 "Build-Date: " __DATE__ " " __TIME__ "\n";
 #endif
+#ifdef __CYGWIN__
+"This version is built by dtech(.hu), http://lighttpd.dtech.hu/\n" \
+"Binary package is compiled with GCC v" __VERSION__ " under Cygwin environment.\n"
+#endif
 ;
 	write_all(STDOUT_FILENO, b, strlen(b));
 }
@@ -621,8 +638,16 @@
 #ifdef NONREPRODUCIBLE_BUILD
 " ("__DATE__ " " __TIME__ ")"
 #endif
-" - a light and fast webserver\n" \
-"usage:\n" \
+" - a light and fast webserver\n"
+#ifdef __CYGWIN__
+"This version is built by dtech(.hu), http://lighttpd.dtech.hu/\n" \
+"Binary package is compiled with GCC v" __VERSION__ " under Cygwin environment.\n" \
+"\n" \
+"Usage:\n"
+" (nothing)  trying to start in test mode with default settings\n"
+#else
+"usage:\n"
+#endif
 " -f <name>  filename of the config-file\n" \
 " -m <name>  module directory (default: "LIBRARY_DIR")\n" \
 " -i <secs>  graceful shutdown after <secs> of inactivity\n" \
@@ -635,6 +660,10 @@
 " -V         show compile-time features\n" \
 " -h         show this help\n" \
 "\n"
+#ifdef __CYGWIN__
+"Notice:\n" \
+"In test mode the server doesn't go to background. (-D option is unnecessary)\n"
+#endif
 ;
 	write_all(STDOUT_FILENO, b, strlen(b));
 }
@@ -956,6 +985,9 @@
 static int server_main (server * const srv, int argc, char **argv) {
 	int print_config = 0;
 	int test_config = 0;
+#ifdef __CYGWIN__
+	int hide_testmode = 0;
+#endif
 	int i_am_root = 0;
 	int o;
 #ifdef HAVE_FORK
@@ -994,6 +1026,10 @@
 	srv->srvconf.dont_daemonize = 0;
 	srv->srvconf.preflight_check = 0;
 
+#ifdef __CYGWIN__
+	disable_cygpathwarn();
+#endif
+
 	while(-1 != (o = getopt(argc, argv, "f:m:i:hvVD1pt"))) {
 		switch(o) {
 		case 'f':
@@ -1020,8 +1056,13 @@
 			idle_limit = (time_t)timeout;
 			break;
 		}
-		case 'p': print_config = 1; break;
-		case 't': ++test_config; break;
+#ifdef __CYGWIN__
+		case 'p': hide_testmode = 1; print_config = 1; break;
+		case 't': hide_testmode = 1; ++test_config; break;
+#else
+ 		case 'p': print_config = 1; break;
+ 		case 't': ++test_config; break;
+#endif
 		case '1': if (0 == oneshot_fd) oneshot_fd = dup(STDIN_FILENO);
 			  break;
 		case 'D': srv->srvconf.dont_daemonize = 1; break;
@@ -1034,11 +1075,29 @@
 		}
 	}
 
+#ifdef __CYGWIN__
+	/* Trying to start in test mode (Win32 version only) */
+	if (!srv->config_storage) {
+		srv->srvconf.dont_daemonize = 1;
+
+		if (hide_testmode == 0) {
+		log_error_write(srv, __FILE__, __LINE__, "s",
+				"trying to read configuration (test mode)");
+		}
+
+		if (config_read(srv, "conf/lighttpd.conf")) {
+			srv->srvconf.dont_daemonize = 1;
+			server_free(srv);
+			return -1;
+		}
+	}
+#else
 	if (!srv->config_storage) {
 		log_error_write(srv, __FILE__, __LINE__, "s",
 				"No configuration available. Try using -f option.");
 		return -1;
 	}
+#endif
 
 	if (print_config) {
 		data_unset *dc = srv->config_context->data[0];
--- ./src/configfile.c	2018-03-12 00:52:20.000000000 +0100
+++ ./src/configfile.c	2018-04-03 10:43:39.848271200 +0200
@@ -24,6 +24,9 @@
 #include <limits.h>
 #include <glob.h>
 
+#ifdef __CYGWIN__
+#include <sys/cygwin.h>
+#endif
 
 #if defined(HAVE_MYSQL) || (defined(HAVE_LDAP_H) && defined(HAVE_LBER_H) && defined(HAVE_LIBLDAP) && defined(HAVE_LIBLBER))
 static void config_warn_authn_module (server *srv, const char *module) {
@@ -676,6 +679,10 @@
 static int tokenizer_open(server *srv, tokenizer_t *t, buffer *basedir, const char *fn) {
 	if (buffer_string_is_empty(basedir) ||
 			(fn[0] == '/' || fn[0] == '\\') ||
+#ifdef __CYGWIN__
+			/* Win32 drive letter fix */
+			(fn[1] == ':') ||
+#endif
 			(fn[0] == '.' && (fn[1] == '/' || fn[1] == '\\'))) {
 		t->file = buffer_init_string(fn);
 	} else {
@@ -1243,6 +1250,30 @@
 	return s;
 }
 
+#ifdef __CYGWIN__
+/* Win32 style path fix on Cygwin */
+static char* getcwd_win32(size_t pathlen) {
+	char *posixpath;
+	char *winpath;
+	posixpath = malloc(pathlen);
+	winpath = malloc(pathlen);
+
+	getcwd(posixpath, pathlen);
+
+	if (cygwin_conv_path(CCP_POSIX_TO_WIN_A, posixpath, winpath, pathlen)) {
+		return NULL;
+	} else {
+		int len = pathlen;
+		for (int i = 0; i < len; i++) {
+			if (winpath[i] == '\\') {
+				winpath[i] = '/';
+			}
+		}
+		return winpath;
+	}
+}
+#endif
+
 int config_parse_cmd(server *srv, config_t *context, const char *cmd) {
 	tokenizer_t t;
 	int ret;
@@ -1337,8 +1368,14 @@
 	array_insert_unique(dc->value, (data_unset *)dpid);
 
 	dcwd = data_string_init();
-	buffer_string_prepare_copy(dcwd->value, 1023);
-	if (NULL != getcwd(dcwd->value->ptr, dcwd->value->size - 1)) {
+#ifdef __CYGWIN__
+	/* Win32 path fixes -> get absolute path and replace backslashes */
+	buffer_string_prepare_copy(dcwd->value, PATH_MAX - 1);
+	if (NULL != (dcwd->value->ptr = getcwd_win32(dcwd->value->size - 1))) {
+#else
+ 	buffer_string_prepare_copy(dcwd->value, 1023);
+ 	if (NULL != getcwd(dcwd->value->ptr, dcwd->value->size - 1)) {
+#endif
 		buffer_commit(dcwd->value, strlen(dcwd->value->ptr));
 		buffer_copy_string_len(dcwd->key, CONST_STR_LEN("var.CWD"));
 		array_insert_unique(dc->value, (data_unset *)dcwd);
