https://github.com/moshegroot/webserver21
Implementation of webserver like nginx
https://github.com/moshegroot/webserver21
cpp cpp98 http sockets tcp webserver
Last synced: about 1 month ago
JSON representation
Implementation of webserver like nginx
- Host: GitHub
- URL: https://github.com/moshegroot/webserver21
- Owner: MosheGroot
- Created: 2021-12-08T16:01:43.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-03-28T09:55:08.000Z (almost 4 years ago)
- Last Synced: 2025-01-20T15:31:31.946Z (about 1 year ago)
- Topics: cpp, cpp98, http, sockets, tcp, webserver
- Language: C++
- Homepage:
- Size: 754 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Webserv project
## Goal:
Write own implementation of web server like nginx one with next capabilities:
* custom configs
* multiple servers handling at one or different `ip:port` pairs
* multiple client-server connections
* simple CGI
* multiple routes in server, error pages, redirects and max client body size paramets
* `GET`, `POST` and `DELETE` methods with `HTTP/1.1` version of requests
Language: `C++98`
## Result
* Structured code with object-oriented principles splitted by 5 parts:
+ Config
+ Core
+ Http
+ CGI
+ Utils
* Custom configs with multiple servers with next parameters:
+ ip and port
+ server_name
+ max client body size
+ locations:
+ uri
+ root
+ index
+ autoindex
+ allowed methods
+ cgi
+ redirect
* Multiple servers at one or different ip:port socket
* Multiplexing with low-level `select` function for non-blocking sockets problem-solving
* `GET`, `POST` and `DELETE` methods
* Autoindex pages
* Execution of simple CGI bash scripts or binaries
* Simple thread-unsafety logger to console and file
### Runtime
https://user-images.githubusercontent.com/44144647/157638273-f731b1a1-6515-4f27-a8d6-536540f81058.mp4
## Contributors
|
[PP189B][PP189B_profile] |
[Uliana-So][Uliana-So_profile] |
[AliceFromWardenfell][AliceFromWardenfell_profile] |
|---------------------------------------|------------------------------------------|---------------------------------------------------------------|
| HTTP + requests processing + default pages | Config + CGI + [Kvast website](https://github.com/Uliana-S/kvast_htmlacademy) | Client-server connections, multiplexing and etc. |
## Testing
### Current configuration
* [Kvast website](https://github.com/Uliana-S/kvast_htmlacademy) at `http://kvast.webserv.local`

* Test website at `webserv.local:8888`

* Default website at `default.webserv.local:8888`

###### (P.S. you need to configure domains in `hosts` file of your system for testing)
### Configurating
Use this template for adding new server:
```
server
ip <...>
port <...>
server_name
max_body_size
location
root <...>
index <...>
cgi <...>
redirect <...>
method
autoindex
location
...
```
### Build and run
```
make
./webserver [path_to_config]
```
[PP189B_profile]: https://github.com/PP189B
[Uliana-So_profile]: https://github.com/Uliana-So
[AliceFromWardenfell_profile]: https://github.com/AliceFromWardenfell