{"id":15049463,"url":"https://github.com/johnguoy/simple_httpd","last_synced_at":"2026-02-18T09:02:11.829Z","repository":{"id":109150827,"uuid":"381082946","full_name":"JohnGuoy/simple_httpd","owner":"JohnGuoy","description":"一个简单的 HTTP 服务器。","archived":false,"fork":false,"pushed_at":"2022-02-04T15:14:00.000Z","size":24,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-19T21:39:41.467Z","etag":null,"topics":["c89","http","httpd","linux","webserver"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JohnGuoy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-28T15:41:32.000Z","updated_at":"2024-04-20T07:48:38.000Z","dependencies_parsed_at":"2023-05-09T20:00:36.692Z","dependency_job_id":null,"html_url":"https://github.com/JohnGuoy/simple_httpd","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JohnGuoy/simple_httpd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnGuoy%2Fsimple_httpd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnGuoy%2Fsimple_httpd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnGuoy%2Fsimple_httpd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnGuoy%2Fsimple_httpd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JohnGuoy","download_url":"https://codeload.github.com/JohnGuoy/simple_httpd/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnGuoy%2Fsimple_httpd/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29574065,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T08:38:15.585Z","status":"ssl_error","status_checked_at":"2026-02-18T08:38:14.917Z","response_time":162,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c89","http","httpd","linux","webserver"],"created_at":"2024-09-24T21:20:35.598Z","updated_at":"2026-02-18T09:02:11.807Z","avatar_url":"https://github.com/JohnGuoy.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 一个简单的 HTTP 服务器\r\n\r\n使用 C 语言（C89）编写，基于 Linux 多线程的一个简单的 HTTP 服务器，支持 Python 或者 PHP 动态脚本。\r\n\r\n## 构建\r\n\r\n软件构建环境需求：\r\n\r\n* Linux 操作系统\r\n* gcc 编译器\r\n* cmake 构建器\r\n\r\n如果要测试 Python 或者 PHP 动态脚本，那么还需要安装并配置好 Python 或者 PHP 的运行环境。\r\n\r\n克隆代码到本地工作目录：\r\n\r\n`$ git clone https://github.com/JohnGuoy/simple_httpd.git`\r\n\r\n构建：\r\n\r\n```bash\r\n$ cd ./simple_httpd/build/\r\n$ cmake ..\r\n-- The C compiler identification is GNU 4.8.5\r\n-- Check for working C compiler: /usr/bin/cc\r\n-- Check for working C compiler: /usr/bin/cc -- works\r\n-- Detecting C compiler ABI info\r\n-- Detecting C compiler ABI info - done\r\n-- Configuring done\r\n-- Generating done\r\n-- Build files have been written to: /root/Projects/TCP-IP/24.2/build\r\n$ make\r\nScanning dependencies of target simple_httpd\r\n[100%] Building C object CMakeFiles/simple_httpd.dir/main.c.o\r\nLinking C executable simple_httpd\r\n[100%] Built target simple_httpd\r\n```\r\n\r\n得到可执行程序 simple_httpd。\r\n\r\n## 运行\r\n\r\n运行 simple_httpd 程序，绑定任意未被占用的端口，Web 根目录默认是当前工作目录：\r\n\r\n`$ ./simple_httpd 6677`\r\n\r\n打开浏览器，输入以下 URL 进行测试：\r\n\r\n```url\r\nhttp://\u003c 运行 simple_httpd 程序的服务器的 IP\u003e:6677/index.html\r\nhttp://\u003c 运行 simple_httpd 程序的服务器的 IP\u003e:6677/index.py\r\nhttp://\u003c 运行 simple_httpd 程序的服务器的 IP\u003e:6677/index.php\r\nhttp://\u003c 运行 simple_httpd 程序的服务器的 IP\u003e:6677/index1.html\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnguoy%2Fsimple_httpd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnguoy%2Fsimple_httpd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnguoy%2Fsimple_httpd/lists"}