- Use cppweb to build a simple http server and https server
linux available
-
git clone https://gitee.com/chenxuan520/server-for-static-web.git
-
./install.sh
-
Fill in the port and other information
-
Server running
-
Fill in the bound port (eg 5200)
-
Fill in the default html file name (index.html) of the web page
-
Fill in whether to run in the background (true or false)
-
Fill in whether to use daemon (true or false)
Both windows and linux are available
-
git clone https://gitee.com/chenxuan520/server-for-static-web.git
-
make (make -f makefile.win under windows)
If you have https certificate, you can also make ssl
-
Modify config.json,introduction
-
./main
-
If not running in the background, the shell will end together
-
The daemon process can ensure fast restart after downtime
-
Modify config.json directly
-
./main --reload
- ./main --stop
- ./main --config=(file name)
- ./main --help
-
Used to modify the configuration method, the script method is invalid
-
You need to install openssl in advance
sudo apt install openssl libssl-devopenssl genrsa -des3 -out privkey.pem 2048
openssl req -new -key privkey.pem -out cert.csr
openssl req -new -x509 -key privkey.pem -out cacert.pem -days 1095-
The acquisition path is the domain name purchase place or freessl
-
Download the certificate for nginx, including a pem and a key
-
Convert key to pem
openssl rsa -in (key name).key -out (new name).pem-
Change the values of "cert path" and "key path" to the certificate path
-
if there is no password comment the line "cert password"
-
make ssl
-
./main