Skip to content

a-cha/webserver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Web Server

HTTP Web Server written in C++98 according to the RFC 7230-7235 standard

Features:

  • Client-server connection (multiple clients connection available)
  • Listening on multiple ports
  • Launching several servers
  • GET, POST, PUT, HEAD methods
  • Error management
  • Chunked-requests processing
  • Autoindex
  • CGI-scripts support
  • Client's authorization

This server was implemented as a reference to Nginx HTTP 1.1 compliant.

Usage

Run make inside the repository's directory to build webserv binary. You can also use CMakeLists.txt file.

Program needs the path to configuration file as an argument (example in conf directory).

Setting up the configuration file

In the main server directive we can specify:

  • Server ports    listen 80 81
  • Server name    server_name example.com
  • Root directory    root /Users/me/cpp_webserver/resources
  • Custom error pages    error_page 405 /40x.html
  • On/off autoindex    autoindex on

In the location directive we can specify:

  • Root directory    root /Users/me/cpp_webserver/resources/42_test
  • Default index page    index index.html
  • Available methods    limit_except POST GET
  • Limit of received body size    client_max_body_size 1000
  • Path to the CGI script interpreter    fastcgi_pass /Users/me/cpp_webserver/resources/cgi_tester
  • Authorization credentials    auth_basic user1:qwerty1234