手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

Web服务(一)HTTP基础详解

[日期:2014-03-27] 来源:Linux社区  作者:chenpipi [字体:大 中 小]

四、web服务httpd软件介绍

linux下http的软件有很多;例如apache:httpd和nginx,这里以httpd为介绍

httpd属性:高度模块化;可以动态装卸载模块。主要是core和modules组合模式的。还支持MPM(Multipath Processing Module):多道处理模块。它不是一个模块;而是对一种特性的称谓。

MPM对应web服务并行结构的模块:

prefock:预fock;一个进程一个请求。

在请求时web服务本身不响应该请求;而是自身fock一个子进程来响应进程;而fock是需要时间来生成子进程的;因此在请求来时,预先fock一些进程来等待请求予以响应;并保持一定的空闲子进程等待其他请求。


worker:一个进程多个线程;一个线程一个请求。

由多个进程生成多个线程;每个线程对应一个请求;如果多个请求在一个进程下请求同一个资源;可以进行资源共享。但是是由于单个线程进行响应请求;需要被调度切换;切换过程还是比较浪费资源。在性能上与prefock是差不多的。


event:一个进程响应对个请求

基于event-driven(事件驱动);单线程响应多个请求。对应web并行结构中的复用的多线程I/O结构。

httpd版本:

httpd-1.3; httpd-2.0; httpd-2.2; httpd-2.4;四个版本。目前官网上2.0-2.4都处于维护状态。

httpd的部分重要功能特性:

路径别名:alias

用户认证:authentication

虚拟主机:virtual host

反向代理:


负载均衡:

用户站点:

CGI:Common Gateway Interface

五、安装httpd

可以先查看下系统内是否安装

[Linux]#rpm -qa httpd

httpd-2.2.15-29.el6.CentOS.x86_64

#显示已安装2.2.15版本


如系统内没有安装可以配置好yum源后安装

[Linux]#yum -y install httpd

#安装完成后可以查看下安装详情和具体的目录

[Linux]#rpm -ql httpd

/etc/httpd

/etc/httpd/conf

/etc/httpd/conf.d

/etc/httpd/conf.d/README

/etc/httpd/conf.d/welcome.conf

/etc/httpd/conf/httpd.conf

/etc/httpd/conf/magic

/etc/httpd/logs

/etc/httpd/modules

/etc/httpd/run

/etc/logrotate.d/httpd

/etc/rc.d/init.d/htcacheclean

/etc/rc.d/init.d/httpd

/etc/sysconfig/htcacheclean

/etc/sysconfig/httpd

/usr/lib64/httpd

 

#安装完成后即可启动

[Linux]#service httpd start

Starting httpd: [ OK ]

[Linux]#ps aux | grep httpd

root 3422 0.0 0.7 184284 3844 ? Ss 16:20 0:00 /usr/sbin/httpd

apache 3425 0.0 0.6 184420 3052 ? S 16:20 0:00 /usr/sbin/httpd

apache 3426 0.0 0.6 184420 3144 ? S 16:20 0:00 /usr/sbin/httpd

apache 3427 0.0 0.6 184420 3052 ? S 16:20 0:00 /usr/sbin/httpd

apache 3428 0.0 0.6 184420 3068 ? S 16:20 0:00 /usr/sbin/httpd

apache 3429 0.0 0.6 184420 3068 ? S 16:20 0:00 /usr/sbin/httpd

apache 3430 0.0 0.4 184284 2440 ? S 16:20 0:00 /usr/sbin/httpd

apache 3431 0.0 0.4 184284 2440 ? S 16:20 0:00 /usr/sbin/httpd

apache 3432 0.0 0.4 184284 2440 ? S 16:20 0:00 /usr/sbin/httpd


启动成功后在浏览器输入对应的IP地址

显示如上界面说明已安装且启动成功。到此基本介绍和安装已完成,下一篇Web服务(二)httpd配置参数详细介绍将详细介绍httpd的配置参数与编译安装2.4版本。http://www.linuxidc.com/Linux/2014-03/98953.htm

linux
相关资讯       HTTP