Please refer to the ServerConfig object properties for all configuration items: https://pkg.go.dev/github.com/gogf/gf/v2/net/ghttp#ServerConfig

    Below is the configuration file template:

    1. server:
    2. # Basic Configuration
    3. address: ":80" # Local listening address. Default is ":80", multiple addresses are separated by ",". For example: "192.168.2.3:8000,10.0.3.10:8001"
    4. httpsAddr: ":443" # TLS/HTTPS configuration, also requires certificate and key configuration. Default is off. Configuration format is the same as above.
    5. httpsCertPath: "" # Local path of the TLS/HTTPS certificate file, absolute path is recommended. Default is off
    6. httpsKeyPath: "" # Local path of the TLS/HTTPS key file, absolute path is recommended. Default is off
    7. readTimeout: "60s" # Request read timeout, generally not needed. Default is 60 seconds
    8. writeTimeout: "0" # Data write timeout, generally not needed. Default is no timeout (0)
    9. idleTimeout: "60s" # Valid only when Keep-Alive is enabled, request idle time. Default is 60 seconds
    10. maxHeaderBytes: "10240" # Request Header size limit (Byte). Default is 10KB
    11. keepAlive: true # Whether to enable Keep-Alive. Default is true
    12. serverAgent: "GoFrame HTTP Server" # Server agent information. Default is "GoFrame HTTP Server"
    13. # API Documentation
    14. openapiPath: "/api.json" # OpenAPI API document address
    15. swaggerPath: "/swagger" # Built-in SwaggerUI display address
    16. # Static Service Configuration
    17. indexFiles: ["index.html","index.htm"] # Automatic homepage static file search. Default is ["index.html", "index.htm"]
    18. indexFolder: false # Whether to display the list of files in the directory when accessing static file directory. Default is off, request will return 403
    19. serverRoot: "/var/www" # Root path of static file service, automatically enables static file service when configured. Default is off
    20. searchPaths: ["/home/www","/var/lib/www"] # Additional file search paths for providing static file service when the root path is not found, search in order. Default is off
    21. fileServerEnabled: false # Total switch for static file service. Default is false
    22. # Cookie Configuration
    23. cookieMaxAge: "365d" # Cookie validity period. Default is 365 days
    24. cookiePath: "/" # Cookie valid path. Default is "/" meaning valid for all paths on the site
    25. cookieDomain: "" # Cookie valid domain. Default is the domain name of the current configured Cookie
    26. # Sessions Configuration
    27. sessionMaxAge: "24h" # Session validity period. Default is 24 hours
    28. sessionIdName: "gfsessionid" # Key name of SessionId. Default is gfsessionid
    29. sessionCookieOutput: true # Whether to return SessionId to Cookie when Session feature is enabled. Default is true
    30. sessionPath: "/tmp/gsessions" # File directory path for Session storage. Default is gsessions directory under the current system temporary directory
    31. # Basic Log Configuration
    32. # This configuration is similar to nginx, mainly for request log recording
    33. logPath: "" # Directory path for storing log files, absolute path is recommended. Default is empty, meaning off
    34. logStdout: true # Whether to output the log to the terminal. Default is true
    35. errorStack: true # Whether to record stack information to the log when Server catches exceptions. Default is true
    36. errorLogEnabled: true # Whether to record exception log information to the log. Default is true
    37. errorLogPattern: "error-{Ymd}.log" # Exception error log file format. Default is "error-{Ymd}.log"
    38. accessLogEnabled: false # Whether to record access logs. Default is false
    39. accessLogPattern: "access-{Ymd}.log" # Access log file format. Default is "access-{Ymd}.log"
    40. # Extended Log Configuration (Parameter log component configuration)
    41. # This configuration mainly affects server (ghttp module) logs, such as web service listening port, web service routes, and does not affect g.Log
    42. logger:
    43. path: "/var/log/" # Log file path. Default is empty, meaning off, only output to terminal
    44. file: "{Y-m-d}.log" # Log file format. Default is "{Y-m-d}.log"
    45. prefix: "" # Log content output prefix. Default is empty
    46. level: "all" # Log output level
    47. timeFormat: "2006-01-02T15:04:05" # Custom time format for log output, configured using Golang standard time format
    48. ctxKeys: [] # Custom Context variable names, automatically print Context variables to logs. Default is empty
    49. header: true # Whether to print the log header information. Default is true
    50. stdout: true # Whether to output the log to the terminal at the same time. Default is true
    51. rotateSize: 0 # Rotate files by file size. Default is 0, meaning rotating feature is off
    52. rotateExpire: 0 # Rotate files by time interval. Default is 0, meaning rotating feature is off
    53. rotateBackupLimit: 0 # Clean up split files by the number of split files when splitting feature is enabled. Default is 0, meaning no backup, split and delete
    54. rotateBackupExpire: 0 # Clean up split files by their validity period when splitting feature is enabled. Default is 0, meaning no backup, split and delete
    55. rotateBackupCompress: 0 # Compression ratio (0-9) for rotated files. Default is 0, meaning no compression
    56. rotateCheckInterval: "1h" # Time check interval for rotating splits, generally not needed. Default is 1 hour
    57. stdoutColorDisabled: false # Disable color printing on the terminal. Default is on
    58. writerColorEnable: false # Whether to include color in log files. Default is false, meaning no color
    59. # PProf Configuration
    60. pprofEnabled: false # Whether to enable PProf performance debugging feature. Default is false
    61. pprofPattern: "" # Valid only when PProf is enabled, indicates the page access path of the PProf feature, effective for all domains bound to the current Server.
    62. # Graceful Restart Feature
    63. graceful: false # Whether to enable graceful restart feature, adds a local TCP port with 10000 for inter-process communication when enabled. Default is false
    64. gracefulTimeout: 2 # Seconds for the parent process to exit after a graceful restart, default is 2 seconds. If the request takes more time than this value, it may cause the request to be interrupted
    65. gracefulShutdownTimeout: 5 # When the Server is shut down, if there are HTTP requests being executed, how many seconds the Server waits before forcing close
    66. # Other Configuration
    67. clientMaxBodySize: 810241024 # Client's maximum Body upload limit size, affects file upload size (Byte). Default is 8*1024*1024=8MB
    68. formParsingMemory: 1048576 # Buffer size (Byte) when parsing forms, generally not needed. Default is 1024*1024=1MB
    69. nameToUriType: 0 # Route generation rule when using object registration in route registration. Default is 0
    70. routeOverWrite: false # Whether to forcibly overwrite when encountering duplicate route registration. Default is false, duplicate routes will cause an error and exit at startup
    71. dumpRouterMap: true # Whether to print all route lists when the Server starts. Default is true