# Configuration for the official 42 tester, tester42/official/tester. # # Every path below is relative to the repository root, so run both from there: # ./webserv conf/tester.conf # ./tester42/official/tester http://localhost:8000 server { # 0.0.0.0 accepts connections arriving on any interface. 127.0.0.1 would # accept only those from the same machine. listen 0.0.0.0:8000; server_name webserv.tester; # The tester POSTs a 100 MB body, so the ceiling here has to sit above it. # /post_body lowers it again for that one location. client_max_body_size 200m; root ./tester42/YoupiBanane; index index.html; # GET only, so that POST and HEAD on / answer 405. location / { allow_methods GET; } # alias and not root, and this is the case that shows they differ. The # server root is already YoupiBanane, so root would map /directory/nop onto # YoupiBanane/directory/nop, which does not exist. alias replaces the # matched prefix instead of keeping it. # # index youpi.bad_extension makes GET /directory and GET /directory/nop # succeed while GET /directory/Yeah gives 404, since Yeah is the one # subdirectory without that file. autoindex must stay off, or the listing # would answer 200 there instead. location /directory { alias ./tester42/YoupiBanane; allow_methods GET; index youpi.bad_extension; autoindex off; } # Matched by extension, and this match wins over the /directory prefix # above, so POST /directory/youpi.bla reaches the CGI and not the static # handler. GET is allowed as well because the same path is also requested # with GET, and a location matched by extension sends every method to the # CGI. location ~ \.bla$ { allow_methods GET POST; cgi_pass ./tester42/official/cgi_tester; } # The limit is inclusive: a body of exactly 100 bytes succeeds, 101 gives # 413. Bodies arrive chunked with no Content-Length, so the count is taken # on decoded bytes as they stream in. location /post_body { allow_methods POST; client_max_body_size 100; } }