libevent http-server示例

2023-12-14 12:21:31
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

启动服务

文章来源:https://blog.csdn.net/fareast_mzh/article/details/134988037
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。