wget https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz
tar xvzf libevent-2.1.12-stable.tar.gz -C .
cd libevent-2.1.12-stable
mkdir cmake-build-debug
cd cmake-build-debug
cmake ../ -DCMAKE_BUILD_TYPE=Debug
make
在sample目录下创建htdocs目录
* sample/htdocs/index.html
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>libevent http-server</title>
</head>
<style>
img.flag {
display: inline-block;
padding: 2px 4px;
vertical-align: middle;
}
</style>
<body>
<div>
<a href="https://my.vultr.com/subs/?id=ce5ba1e0-7ae9-46b8-87d8-d671b11472d2">
<img class="flag" src="./images/flagsm_il.webp" title="vultr" alt="Israel"/>It works.
</a>
</div>
<p>This is <a href="https://libevent.org/">libevent</a> http-server test.</p>
</body>
</html>
配置远程服务器
https://my.vultr.com/_images/flags/flagsm_il.png
http-server -p 18080 -v htdocs
启动服务
标签:12,http,示例,libevent,server,stable,2.1 From: https://blog.51cto.com/u_11658127/8920828