apache安装

Apahce官网:httpd://httpd.apache.org/

一.安装
1.yum安装yum install httpd -y


2. 开启80端口: vi /etc/sysconfig/iptables


3.重启防火墙:service iptables restart


4.系统默认启动:chkconfig httpd on


二.配置apache服务

1.连接时间:

vi /etc/httpd/conf/httpd.conf  

Timeout 60  //接收或发送,当持续连接等待超过60秒则该连接就中断


2.网页主目录:yum安装默认的目录路径为:/var/www/html


三.源码包安装

1.# tar zxvf httpd-2.2.*.tar.gz

# cd httpd-*

# ./configure  --prefix=/usr/local/apache2  (默认安装位置)   (编译时,需要gcc软件)

# make

#make install


2.apache的配置修改

# vi  /usr/local/apache2/conf/httpd.conf  

 将#ServerName www.example.com:80 中的“#”删掉,并将 www.example.com 改为本机的linux的ip地址


设置Apache服务的启动级别:chkconfig --levels 235 httpd on

如果出现it works字样,说明apache安装成功