浏览代码

Sort options in per domain, per server and main.c options, and document it

Move (deprecated) "deamonize" into main.c
Move access log and error log to per domain section
Document options
bel2125 4 年之前
父节点
当前提交
52425fc70f
共有 3 个文件被更改,包括 61 次插入23 次删除
  1. 47 13
      docs/UserManual.md
  2. 6 10
      src/civetweb.c
  3. 8 0
      src/main.c

+ 47 - 13
docs/UserManual.md

@@ -281,6 +281,11 @@ will be accepted.
 ### enable\_directory\_listing `yes`
 Enable directory listing, either `yes` or `no`.
 
+### enable\_http2 `no`
+Enable HTTP2 protocol.  Note: This option is only available, if the server has been
+compiled with the `USE_HTTP2` define.  The CivetWeb server supports only a subset of
+all HTTP2 features.
+
 ### enable\_keep\_alive `no`
 Enable connection keep alive, either `yes` or `no`.
 
@@ -640,14 +645,14 @@ Sets the minimal accepted version of SSL/TLS protocol according to the table:
 
 Protocols | Value
 ------------ | -------------
-SSL2+SSL3+TLS1.0+TLS1.1+TLS1.2  | 0
-SSL3+TLS1.0+TLS1.1+TLS1.2  | 1
-TLS1.0+TLS1.1+TLS1.2 | 2
-TLS1.1+TLS1.2 | 3
-TLS1.2 | 4
+SSL2+SSL3+TLS1.0+TLS1.1+TLS1.2+TLS1.3 | 0
+SSL3+TLS1.0+TLS1.1+TLS1.2+TLS1.3  | 1
+TLS1.0+TLS1.1+TLS1.2+TLS1.3 | 2
+TLS1.1+TLS1.2+TLS1.3 | 3
+TLS1.2+TLS1.3 | 4
+TLS1.3 | 5
 
-More recent versions of OpenSSL include support for TLS version 1.3.
-To use TLS1.3 only, set ssl\_protocol\_version to 5.
+TLS version 1.3 is only available if you are using an up-to-date TLS libary.
 
 ### ssl\_short\_trust `no`
 Enables the use of short lived certificates. This will allow for the certificates
@@ -778,7 +783,7 @@ with websocket support enabled.
 
 The following options are supported in `main.c`, the additional source file for
 the stand-alone executable. These options are not supported by other applications
-embedding `civetweb.c`, unless they are added explicitly.
+embedding `civetweb.c`, unless they are added to the embedding application.
 
 ### title
 Use the configured string as a server name.  For Windows, this will be shown as
@@ -792,15 +797,44 @@ icon.  This option has no effect for Linux.
 For Windows, use this website as a link in the systray, replacing the default
 link for CivetWeb.
 
+### hide\_tray `no`
+For Windows: Do not show a tray icon. May be `yes` (hide) or `no` (show, default).
+
+### daemonize `no`
+This option is only available for Linux, if the server has been build with the
+`DAEMONIZE` compile options.  Call (deprecated) `daemon()` BSD function to
+detach the server process from the controlling terminal and run it in the
+background as a system daemon.
+
 ### add\_domain
 Option to load an additional configuration file, specifying an additional domain
 to host.  To add multiple additional domains, use the add\_domain option
 multiple times with one configuration file for each domain.
-A domain configuration file may have the same options as the main server, with
-some exceptions.  The options are passed to the `mg_start_domain` API function.
-
-### hide\_tray `no`
-Do not show a tray icon. May be `yes` (hide) or `no` (show, default).
+This option is available for Windows and Linux operating systems.
+
+Internally, the options are passed to the `mg_start_domain` API function.
+If you are not using `main.c`, you need to call this API function to activate
+and additional domain.
+
+Every domain configuration file may contain a subset of the options available for
+the main server configuration files, with some exceptions.   Some configurations
+are per server while others are available for each domain.
+
+All port, socket, process and thread specific parameters are per server:
+`allow_sendfile_call`, `case_sensitive`, `connection_queue`, `decode_url`,
+`enable_http2`, `enable_keep_alive`, `enable_websocket_ping_pong`,
+`keep_alive_timeout_ms`, `linger_timeout_ms`, `listen_backlog`,
+`listening_ports`, `lua_background_script`, `lua_background_script_params`,
+`max_request_size`, `num_threads`, `request_timeout_ms`, `run_as_user`,
+`tcp_nodelay`, `throttle`, `websocket_timeout_ms` + all options from `main.c`.
+
+All other options can be set per domain. In particular
+`authentication_domain`, `document_root` and (for HTTPS) `ssl_certificate`
+must be set for each additional domain.
+
+While some options like `error_log_file` are per domain, the setting of the
+initial (main) domain may be used if the server could not determine the
+correct domain for a specific request.
 
 
 Scripting

+ 6 - 10
src/civetweb.c

@@ -2077,8 +2077,6 @@ enum {
 	CASE_SENSITIVE_FILES,
 #endif
 	THROTTLE,
-	ACCESS_LOG_FILE,
-	ERROR_LOG_FILE,
 	ENABLE_KEEP_ALIVE,
 	REQUEST_TIMEOUT,
 	KEEP_ALIVE_TIMEOUT,
@@ -2098,6 +2096,9 @@ enum {
 	/* Once for each domain */
 	DOCUMENT_ROOT,
 
+	ACCESS_LOG_FILE,
+	ERROR_LOG_FILE,
+
 	CGI_EXTENSIONS,
 	CGI_ENVIRONMENT,
 	CGI_INTERPRETER,
@@ -2188,9 +2189,6 @@ enum {
 #endif
 	ADDITIONAL_HEADER,
 	ALLOW_INDEX_SCRIPT_SUB_RES,
-#if defined(DAEMONIZE)
-	ENABLE_DAEMONIZE,
-#endif
 
 	NUM_OPTIONS
 };
@@ -2217,8 +2215,6 @@ static const struct mg_option config_options[] = {
     {"case_sensitive", MG_CONFIG_TYPE_BOOLEAN, "no"},
 #endif
     {"throttle", MG_CONFIG_TYPE_STRING_LIST, NULL},
-    {"access_log_file", MG_CONFIG_TYPE_FILE, NULL},
-    {"error_log_file", MG_CONFIG_TYPE_FILE, NULL},
     {"enable_keep_alive", MG_CONFIG_TYPE_BOOLEAN, "no"},
     {"request_timeout_ms", MG_CONFIG_TYPE_NUMBER, "30000"},
     {"keep_alive_timeout_ms", MG_CONFIG_TYPE_NUMBER, "500"},
@@ -2238,6 +2234,9 @@ static const struct mg_option config_options[] = {
     /* Once for each domain */
     {"document_root", MG_CONFIG_TYPE_DIRECTORY, NULL},
 
+    {"access_log_file", MG_CONFIG_TYPE_FILE, NULL},
+    {"error_log_file", MG_CONFIG_TYPE_FILE, NULL},
+
     {"cgi_pattern", MG_CONFIG_TYPE_EXT_PATTERN, "**.cgi$|**.pl$|**.php$"},
     {"cgi_environment", MG_CONFIG_TYPE_STRING_LIST, NULL},
     {"cgi_interpreter", MG_CONFIG_TYPE_FILE, NULL},
@@ -2348,9 +2347,6 @@ static const struct mg_option config_options[] = {
 #endif
     {"additional_header", MG_CONFIG_TYPE_STRING_MULTILINE, NULL},
     {"allow_index_script_resource", MG_CONFIG_TYPE_BOOLEAN, "no"},
-#if defined(DAEMONIZE)
-    {"daemonize", MG_CONFIG_TYPE_BOOLEAN, "no"},
-#endif
 
     {NULL, MG_CONFIG_TYPE_UNKNOWN, NULL}};
 

+ 8 - 0
src/main.c

@@ -229,6 +229,10 @@ enum {
 	OPTION_WEBPAGE,
 	OPTION_ADD_DOMAIN,
 	OPTION_HIDE_TRAY,
+#if defined(DAEMONIZE)
+	ENABLE_DAEMONIZE,
+#endif
+
 	NUM_MAIN_OPTIONS
 };
 
@@ -238,6 +242,10 @@ static struct mg_option main_config_options[] = {
     {"website", MG_CONFIG_TYPE_STRING, NULL},
     {"add_domain", MG_CONFIG_TYPE_STRING_LIST, NULL},
     {"hide_tray", MG_CONFIG_TYPE_BOOLEAN, NULL},
+#if defined(DAEMONIZE)
+    {"daemonize", MG_CONFIG_TYPE_BOOLEAN, "no"},
+#endif
+
     {NULL, MG_CONFIG_TYPE_UNKNOWN, NULL}};