diff --git a/config/default.conf b/config/default.conf index 9e76bbc..ee5c443 100644 --- a/config/default.conf +++ b/config/default.conf @@ -11,35 +11,82 @@ # Server Configuration server { - listen localhost:8080; # [M - O] choose a Host:Port combination ; IPv4:{1 - 16bit} ; default: INADDR_ANY:8080 - server_name localhost; # [M - O] Setup the server_names ; [A-Za-z_]* ; default: [EMPTY] - error_dir /error; # [1 - O] Set a directory that has error page ; [/]{1}[A-Za-z_/:w]* ; Default: [EMPTY] + listen 127.0.0.1:8080; + server_name lucy_saus; # [M - O] retup the server_names ; [A-Za-z_]* ; default: [EMPTY] + error_dir /data/errors/; # [1 - O] Set a directory that has error page ; [/]{1}[A-Za-z_/:w]* ; Default: [EMPTY] client_max_body_size 3M; # [1 - O] Limit client body size ; [\d]{1,3}[KkMm]? ; Default: 1 mB location / { # [1 - O] Request Target is the Target of the HTTP request; starts with a / - alias /data/www; # [1 - O] links the stated Direcotry as the RequestTarget Location ; [/]{1}[A-Za-z_/:w]* ; Default: /data/www + alias /data/www/; # [1 - O] links the stated Direcotry as the RequestTarget Location ; [/]{1}[A-Za-z_/:w]* ; Default: /data/www + index index.html; # [1 - O] Set a default file to answer if the request is a directory ; [A-Za-z_/.]* ; Default: index.html + allowed_methods GET; # [M - O] Define a list of accepted HTTP methods for the route; GET/POST/DELETE ; Default: GET + autoindex on; # [B - O] Turn on or off directory listing; on; Default: off + } + +} + +server { + listen 127.0.0.1:8080; # [M - O] choose a Host:Port combination ; IPv4:{1 - 16bit} ; default: INADDR_ANY:8080 + server_name localhost; # [M - O] retup the server_names ; [A-Za-z_]* ; default: [EMPTY] + error_dir /data/errors/; # [1 - O] Set a directory that has error page ; [/]{1}[A-Za-z_/:w]* ; Default: [EMPTY] + client_max_body_size 3M; # [1 - O] Limit client body size ; [\d]{1,3}[KkMm]? ; Default: 1 mB + + location / { # [1 - O] Request Target is the Target of the HTTP request; starts with a / + alias /data/www/; # [1 - O] links the stated Direcotry as the RequestTarget Location ; [/]{1}[A-Za-z_/:w]* ; Default: /data/www index index.html; # [1 - O] Set a default file to answer if the request is a directory ; [A-Za-z_/.]* ; Default: index.html allowed_methods GET; # [M - O] Define a list of accepted HTTP methods for the route; GET/POST/DELETE ; Default: GET autoindex on; # [B - O] Turn on or off directory listing; on; Default: off } location /python/ { - alias /cgi/python; # already defined; - cgi .py /bin/python3; # [1 - O] Set a Path to where the CGI can find the Binary; [A-Za-z_/.]* ; Default: [EMPTY] + alias /cgi/python/; # already defined; + cgi on; # [1 - O] Set a Path to where the CGI can find the Binary; [A-Za-z_/.]* ; Default: [EMPTY] } location /images/ { - root /data/images; # already defined; - allow_methods GET POST; # already defined; - autoindex off; # already defined; + alias /data/images/; + allowed_methods GET POST; + autoindex on; + } + + location /png/ { + alias /data/images/png/; + allowed_methods GET POST; + autoindex off; + } + + location /images/jpg/ { + alias /data/upload/images/jpg/; + allowed_methods GET POST; + autoindex off; } location /upload/ { - root /data/upload; - allowed_moteds POST DELETE; + alias /data/upload/; + allowed_methods POST DELETE; } location /removed_folder/ { - return localhost; # [1 - O] Reroute a directory to another URL; URL ; Default: [] + alias /data/www/; + allowed_methods GET; + return /images/coffee-resized.jpeg ; # [1 - O] Reroute a directory to another URL; URL ; Default: [] } } + +#TODO: all Settings still need implementation into the Webserver +# [ ] SetDefaultValues for configfile. +# [ ] ServerBlock: +# [ ] listen; // +# [ ] server_name; // should go over the Clients/HTTPServers after +# // the request is recieved and see which serverSettings block is relevant to the request; +# [x] error_dir; // should search this direcotry to find the relevant error file [e.g. 404.html]; +# [x] client_max_body_size; // limits the size of the client Request, returning 413 when it exceeds this value; +# [ ] Location Block: +# [x] alias; // should do a fitted preppend on the path in URI; +# [x] index; // file return of the request just specifies this directory ; +# [x] autoindex; // Automaticly should create a Index file that shows an overview of the direcotry; +# [x] allowed_methods; // should check if the HTTP Method is allowed in this location; +# [ ] cgi; // is a boolean that shows if the directory is a CGI and the value is the path to the executable; +# [x] return; // +# [x] HTTPerrorpagegenerator // method that can generate a simple ERROR page to the _response. +# diff --git a/config/simple.conf b/config/simple.conf index d282b77..6641fc6 100644 --- a/config/simple.conf +++ b/config/simple.conf @@ -2,9 +2,8 @@ # Server Configuration server { - port 9696; - host localhost; # Choose the port and host; default for this host:port - server_name lucy_saus; # Setup the server_names or not + listen 127.0.0.1:8080; + server_name eerste_saus; # Setup the server_names or not client_max_body_size 3M; # Limit client body size error_pages 404; @@ -14,3 +13,56 @@ server { allow_methods GET POST; # Define a list of accepted HTTP methods for the route } } + +server { + listen 127.0.1.1:8080; + server_name tweede_saus; # Setup the server_names or not + client_max_body_size 3M; # Limit client body size + error_pages 404; + + location / { + root /data/www; # Define a directory where the file should be searched + index index.html; # Set a default file to answer if the request is a directory + allow_methods GET POST; # Define a list of accepted HTTP methods for the route + } +} + +server { + listen localhost:8080; + server_name sala_SAUS; # Setup the server_names or not + client_max_body_size 3M; # Limit client body size + error_pages 404; + + location / { + root /data/www; # Define a directory where the file should be searched + index index.html; # Set a default file to answer if the request is a directory + allow_methods GET POST; # Define a list of accepted HTTP methods for the route + } +} + +server { + listen localhost:8080; + server_name Lucy_saus; # Setup the server_names or not + client_max_body_size 3M; # Limit client body size + error_pages 404; + + location / { + root /data/www; # Define a directory where the file should be searched + index index.html; # Set a default file to answer if the request is a directory + allow_methods GET POST; # Define a list of accepted HTTP methods for the route + } +} + +server { + listen dump-linux:8080; + server_name maarty-saus; # Setup the server_names or not + client_max_body_size 3M; # Limit client body size + error_pages 404; + + location / { + root /data/www; # Define a directory where the file should be searched + index index.html; # Set a default file to answer if the request is a directory + allow_methods GET POST; # Define a list of accepted HTTP methods for the route + } +} + diff --git a/config/test.conf b/config/test.conf new file mode 100644 index 0000000..416c7a8 --- /dev/null +++ b/config/test.conf @@ -0,0 +1,10 @@ +# Server Configuration + +server { + location / { + alias /data/www; + } +} + + + diff --git a/data/errors/404.html b/data/errors/404.html index 2056402..9a2acb3 100644 --- a/data/errors/404.html +++ b/data/errors/404.html @@ -5,6 +5,9 @@
The requested page could not be found.
+The requested page could not be found.
+
+
This was loaded using our error_dir