一、用yum方式安装

yum install httpd -y


启动Apache服务               service httpd start

设置开机启动                      chkconfig httpd on

关闭Apache服务                  service httpd stop

重启Apache服务                    sevice httpd restart

查看Apache服务运行状态     service httpd stsus

测试   http://IP或网址,如图

linux下安装Apache服务



二、配置Apache服务(Apache配置文件修改后要重启服务,否则配置不会生效)

连接时间   vi /etc/httpd/conf/httpd.conf

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


配置字符集   AddDefaultCharset UTF-8


配置索引页面   DirectoryIndex index.php index.htm index.html index.html index.html.var  //默认索引页面


配置网页主目录  DocumentRoot "/var/www/html"       //网页默认存放的目录


配置连接端口  Listen 80


配置 ServerName    ServerName www.example.com:80    //默认不使用#号,CentOs 6.0 版本后一定要配置







相关文章: