Skip to content
/ serveX Public
forked from joseph-el/serveX

This project is here to make you write your own HTTP server. You will be able to test it with a real browser. HTTP is one of the most used protocol on internet. Knowing its arcane will be useful, even if you won't be working on a website.

Notifications You must be signed in to change notification settings

tnaceur/serveX

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Typing SVG

An flexible HTTP web server!
Explore the docs »

About

serveX is a HTTP web server like nginx , meticulously crafted in C++17 by @joseph-el , @tnaceur and @ELkhalil

Overview

serveX designed to provide a robust and versatile platform for handling web applications. The server is meticulously crafted to support a wide range of features, making it suitable for various web development scenarios

Features

  • HTTP Methods Support: serveX supports all HTTP methods, providing a versatile platform for handling various types of requests.

  • CGI Interpreter: Execute Common Gateway Interface (CGI) scripts seamlessly, allowing dynamic content generation on the server.

  • Multiple CGI Scripts: serveX can handle multiple CGI scripts simultaneously, enabling complex web applications and functionalities.

  • Cookies and Session Management: Easily manage user sessions and store information using cookies, enhancing the interactivity and personalization of web applications.

  • Error Logging: The server includes a high-level error logger that detects errors in configuration files, requests, and responses, providing valuable insights for debugging and maintenance.

Configuration

Optionner

We includes a optionner tool that allows you to fine-tune the server's behavior. Use the following command-line options to configure serveX according to your requirements:

  serveX         # run the server with the default config file: cfg/sx_config
  serveX -h      # Display help
  serveX -v      # Display the server version and exit
  serveX -t      # Test the server configuration and exit
  serveX -T      # Test configuration, dump it, and exit
  serveX -c custom_config.conf  # Set a custom configuration file

syntax

The serveX HTTP web server boasts an expressive and flexible configuration syntax

Server Block

The server block serves as the encapsulating structure for the server configuration. It contains global server settings.

server {
    listen              Host:Port;
    server_name         exampleName;
    client_max_body_size <Size>; 
}

Location Block

The location block allows you to define configurations specific to different URI paths.

location <pathToLocation> {
    root               <path>;
    allowed_methods    <Methods...>;
    index              <indexes>...;
    upload_path        <Path>;
    cgi_path           <pathToCGI>;
    auto_index         <off/on>;
    return             <status>    <PathToRedirection>;
}

Example Configuration

server {
    listen              3333;
    server_name         serverX.com;
    client_max_body_size 500M;

    location / {
        allowed_methods GET HEAD PATCH;
        root             home;
        index            index.html;
    }

    location 42home {
        root             .;
        allowed_methods GET HEAD;
        return           301 https://42.fr/en/homepage/;
    }

    location template {
        root             .;
        index            index.html;
        allowed_methods GET;
    }

    location youtube.com {
        allowed_methods GET;
        root             .;
        return           301 https://www.youtube.com/channel/UCa8CyDeTWLzoP4hvdQ5_l6w;
    }

    location upload {
        root             ./;
        index            index.html;
        allowed_methods GET POST PUT PATCH;
        upload_path      /goinfre/yoel-idr;
    }
}

Usage

clone repository

git clone https://github.com/joseph-el/serveX.git

config file and run

- setup the a config file
make ; ./serveX -c path_of_config.cfg

Acknowledgments

Special thanks to @tnaceur and @ELkhalil for their valuable contributions to the serveX project.

About

This project is here to make you write your own HTTP server. You will be able to test it with a real browser. HTTP is one of the most used protocol on internet. Knowing its arcane will be useful, even if you won't be working on a website.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CSS 28.3%
  • SCSS 27.2%
  • HTML 24.8%
  • C++ 14.2%
  • JavaScript 2.2%
  • PHP 1.0%
  • Other 2.3%