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 2048 by default
server_body_size = int ; server 2048 by default
body_max_size = int ; server 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
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

Clone this wiki locally