Skip to content

williamollio/webserv

Repository files navigation

Webserv

Subject PDF

How does it work?

Setup

  • compile with make
  • run with webserv without any options
  • pick a browser of your choice and visit the server's website by entering the address specified in the *.conf file (standard is localhost)
  • have fun! (changes on the configuration file will only be applied after a server restart)

Configuration

The server can be configured with a configuration-file. This file is either specified at the startup or will be autogenerated by the server if not specified.

Config-File

  • currently we only support one server:
    • it can be specified with the keyword server {...}
    • the server allows following parameters:
      • server_names specifies server-addresses
      • cgi_extspecifies of the extenstion of the cgi's
      • cgi_binmaps extensions to binaries
      • cgi_methodsmethods allowed on CGI requests
      • cgi_rootspecifies path in which requests are always directed
      • port specifies ports to listen to
      • loc predeclares the locations
      • error_pagesspecifies the pages rendered depending on the error code returned
      • accept_filesmanages the access right to upload files
      • root specifies the root folder of the server
      • index specifies the default file of the server
      • upload determine specific folder to store files uploaded by default
      • client_max_body_size _specifies the size payload sent by the client
      • location can be specified further (after declaration only!):
        • directory_listing lists the files/folders of the location
        • root specifies the root folder of the location
        • upload determine specific folder to store files uploaded in the location
        • default_filespecifies the default file of the location
        • methods [GET / POST / DELETE] specifies the methods allowed of the location
        • redirect specifies the path where requests should be redirected to
  • comment with # comment to be ignored by the parser
  • a option is legal when formatted like: <option> : <input> , <input2> ; or <option> { <input> , <input2> }
  • mixing {} and : ; will result in a parser error
  • whitespaces and newline are handled the same
  • missing any delimiter results in undefined behaviour

The config file can be changed in the Makefile or should be set as an argument.

Example configuration file

PHP should be installed if you want to access the directory listing, indeed the path to it should be set up in directory_listing.php (default path : /usr/bin/php).

About

HTTP server using TCP sockets written in C++98

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published