事例学习开发WEBSERVER服务器(一)
来源:互联网 发布:python tf idf 编辑:程序博客网 时间:2024/05/16 11:10
我想有很多朋友和我一样,想要了解APACHE NGINX的工作原理,最终能独立写一个服务器。我对C语言开发几乎一窍不通,看了网上的很多文章,都是先讲SOCKET编程等等几百页之后,才能讲到这里,学习起来很痛苦,经常思考是否可以另外一种方式,倒叙的方式让其他的人学习起来不那么痛苦。好吧废话少说,咱们开始吧~
今天要做的工作目标:配置环境,浏览源代码。
一、下载WEBSERVER程序(下载)
二、安装。make
三、启动服务器端服务。./shttpd
[root@sysadmin webserver]# ./shttpd sHTTPD ListenPort: 8062 MaxClient: 4 DocumentRoot: /usr/local/var/www/ DefaultFile:index.html CGIRoot: DefaultFile:index.html TimeOut:3 ConfigFile:/etc/sHTTPd.conf==>Worker_ScheduleRun==>Worker_Init==>Worker_Add==>worker<==Worker_Add==>Worker_Add==>worker<==Worker_Add<==Worker_Init
四、测试。curl '127.0.0.1:8062/index.html'
[root@sysadmin study]# curl '127.0.0.1:8062/index.html'test
五、SERVER显示
client commingDo task==>do_workselect retval:1Read 166 bytes,'GET /index.html HTTP/1.1User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5Host: 127.0.0.1:8062Accept: */*'==>Request_Parse==>Request_HeaderParse<==Request_HeaderParseURI:'/index.html',patch:'/usr/local/var/www///index.html'<==Request_Parse==>Request_Handle==>Method_Do==>Method_DoGet==>Mine_Typeuri:/index.html,len:11,ext is htmlfound it, ext is html<==Mine_Typen:-1content length:5, status:206<==Method_DoGet<==Method_Doecho header:HTTP/1.1 206 Partial ContentDate: Thu, 04 Apr 2013 13:45:15 GMTLast-Modified: Mon, 01 Apr 2013 21:08:47 GMTEtag: "515986df.5"Content-Type: text/htmlContent-Length: 5Accept-Ranges: bytesContent-Range: bytes 0-4/5, write to client 229 bytes, status:206response len:16384, content length:5read 5 bytes,write 5 bytes<==Request_Handleselect retval:1Read 0 bytes,''<==do_work
六、先到这里!剩下的就是有空的时候看看程序,体会一下结果是什么出来的。
<script type="text/javascript"><!--google_ad_client = "ca-pub-1944176156128447";/* cnblogs 首页横幅 */google_ad_slot = "5419468456";google_ad_width = 728;google_ad_height = 90;//--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
- 事例学习开发WEBSERVER服务器(一)
- WebServer 学习笔记 一
- 【linux-WebServer】nginx学习(CDSN就是用这个服务器)
- WebServer服务器原理(例子)
- VB开发ASP组件经典事例[一]
- linux-2.6.32在mini2440开发板上移植(21)之WebServer服务器移植
- 服务器开发(一)
- WEBSERVER服务器的安全策略
- Mac 开启WebServer 服务器
- Mac 开启WebServer 服务器
- GoAhead 2.1.8嵌入式webserver源码分析学习(一)---开篇
- elasticsearch服务器开发学习笔记(一)
- elasticsearch服务器开发学习笔记(三.一)
- 通过事例学习.net的WebForms技术(一)
- 通过事例学习.net的WebForms技术(一)
- 网络游戏服务器开发(一)
- webServer 接口开发
- GoAhead WebServer 开发总结
- MySQL 5.5 权限导出脚本
- AndroidQuery 开源项目
- 来自各移动平台的设计指导方针
- 一个关于兑换零钱的豆瓣笔试题
- 题目1173:查找
- 事例学习开发WEBSERVER服务器(一)
- ASP.NET 页面传值简单总结 .
- 隐式类类型转换
- 内存管理
- linux shell重定向
- Android Droid-Fu 开源项目
- C中浮点数转字符串
- 【C语言学习趣事】_29_《C程序设计语言》_Secnod_Edition_习题
- JS控制CSS样式语法对照