Skip to content

Configuration file

Daniel-Alessandros Atack edited this page Jun 8, 2022 · 57 revisions

Syntax

Tables Arguments Scope Purpose
server_name = string ; server Setup the name of the server which determine which block is used for a given request, by default "webserv (42) v0.1-dev"
host = string ; server Setup the host of the server, by default "127.0.0.1"
port = int ; server Setups the port listened by the server; by default 3000 assigned to the first server if undefined
index = string ... ; server, location Defines the index file’s name, by default "index.html" if undefined for the first server
root string ; server, location Setups the root path, by default "." for servers
error_pages int ... = string server, location Setups the error pages
read_timeout = int ; server Customizes the timeout reading a request, by default -1
client_header_size = int ; server Client HTTP Request header size limit, 2048 by default
server_body_size = int ; server Limits the size of the request body by the server, 2048 by default
body_max_size = int ; server File upload size limit, 2048 by default
methods = string ... ; location Setups a list of HTTP methods accepted by the location, empty by default
rewrite int string string ; location Setups an HTTP redirection with a redirect_code, url, redirect_url; throws an error if the redirect_code isn't 3xx
auto_index on/off ; location Enables directory listing, by default off
cgi_enable on/off ; location Enables the use of CGI, by default off
cgi_extension = string ... ; location For which file extensions CGI is enabled
cgi_timeout = int ; location Customizes the timeout for a CGI execution, by default -1
send_file on/off ; location Enables direct copying data from one file descriptor to another instead of writing to a buffer first, by default off
file_limit = int ; location Customizes the maximum size of a file in megabytes, by default 5000
max_amount_of_request = int ; server Customizes the maximum amount of requests handled at the same time by the server, by default 100
max_uri_size = int ; server Customizes the maximum size of the URI size handled by the server, by default 100, throws an error if inferior to 30

Clone this wiki locally