diff --git a/inc/lektor/config.h b/inc/lektor/config.h
index 46f253801efd91f817b3044939000c867e90d80b..afba36ba0eb6bdd0f8d491a45374daed0220b786 100644
--- a/inc/lektor/config.h
+++ b/inc/lektor/config.h
@@ -3,6 +3,7 @@
 #include <common/common.h>
 #include <stddef.h>
 #include <sqlite3.h>
+#include <stdio.h>
 
 /* Forward definition of the lkt_state structure */
 struct lkt_state;
@@ -34,3 +35,6 @@ int config_new(volatile sqlite3 *db, const char *conf);
    type is done, it is up to the user to check if the structure passed as a
    `void*` is the right structure. */
 int load_module_by_name(struct lkt_state *srv, const char *name, void *mod);
+
+/* Prints the default config file. */
+void config_default(FILE *output);
diff --git a/src/config.c b/src/config.c
index 9bc21ea8f00e685c1167c61746b89ebb97021935..7fd1c905259f1bdf0005c8619da272c4ae61900c 100644
--- a/src/config.c
+++ b/src/config.c
@@ -248,16 +248,27 @@ int
 config_new(volatile sqlite3 *db, const char *conf)
 {
     if (ini_parse(conf, handler, db)) {
-        LOG_ERROR("Failed to parse file %s", conf);
-        return 1;
+        LOG_ERROR_SCT("CONFIG", "Failed to parse file %s", conf);
+        goto error;
     }
 
     if (validate_conf(db)) {
-        LOG_ERROR("Configuration file %s is incomplete", conf);
-        return 1;
+        LOG_ERROR_SCT("CONFIG", "Configuration file %s is incomplete", conf);
+        goto error;
     }
 
     return 0;
+error:
+    LOG_ERROR_SCT("CONFIG", "%s", "Errors detected in config, here is a default config:");
+    config_default(stdout);
+    return 1;
+}
+
+void
+config_default(FILE *output)
+{
+    fwrite(lkt_default_config_file, sizeof(char),
+           strlen(lkt_default_config_file), output);
 }
 
 int