A WebServer written in C++, which could be suitable for beginners to learn.
- epoll and reactor
- one loop for one thread
- sql connection pool combined with RAII(soci)
- redis connection pool combined with RAII(redis++)
To clone the repository, you can run:
git clone https://github.com/sirius-zyj/WebServer-sirius.git
- Setup boost
Make sure your compuer have setup boost and libmysql, you can run:
sudo apt-get install libboost-all-dev
sudo apt-get install libmysqlclient-dev
- Setup mysql
Make sure your computer have setup mysql5.7 or 8.0.
Then create your own account and modify the content in the file sirius/plugin/config.cpp
accordingly.
To create a simple database, you can run:
create database sirius;
USE sirius;
CREATE TABLE user(
username char(50) NULL,
password char(50) NULL
)ENGINE=InnoDB;
INSERT INTO user(username, password) VALUES('name', 'password');
- Setup redis
Make sure your computer have setup redis, you can run:
sudo apt install redis-server
sudo systemctl status redis
- Make and run
To make the object in your computer, you can run:
cd sirius
sh make.sh
To run the established object, you can run:
sh run.sh
- muduo by chenshuo
- TinyWebServer by qinguoyi
- WebServer by markparticle
- soci
- <<Linux高性能服务器编程>> 游双 著