Skip to content

onapoli/webserv

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

webserv

Project developed by onapoli- & pmira-pe students from 42.

webserv aims to teach how web servers work. So this project is like an Nginx made from zero using C++98 with no external libraries and targetting UNIX operating systems. It implements HTTP/1.1 protocol and CGI/1.1 interface.

Requirements

How to run it

  • For default configuration. Inside the repository directory run:

     make && make start
    

    This will automatically compile the project into webserv executable and execute it with a config file that is based on tests/example_config.json. A directory tests/www/ is generated containing the root directory for the web server and the website content.

  • For alternative default configuration. Inside the repository directory run:

     make
    

    Then run:

     ./webserv
    

    This will run the server using default.json, located at .default/ directory, as the server configuration file, and having .default directory as the server's root.

  • For custom configuration. Create a custom config file in json format (check out tests/example_config.json for reference). Inside the repository directory run:

     make
    

    Then run:

     ./webserv path_to_your_custom_config.json
    

Once the server is running, open a web browser, go to http://configuredhost:configuredport and visit the different configured routes (locations).

These config files have strict rules. Check tests/example_config.json to have an idea of the available options, and feel free to modify it.

How to stop it

  • To stop the server. In the terminal where the server is running press:

     Ctrl + C
    
  • To clean the repository folder removing webserv executable, object files (.o), tests/www directory and generated config file. Inside the repository directory run:

     make fclean
    

About

Our own web server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 88.3%
  • Shell 9.7%
  • HTML 1.1%
  • Makefile 0.9%