Apache服务一简介与安装

一、Apache介绍

1.什么是Apache

  • Apache HTTP Server(简称Apache)是Apache软件基金会的一个开放源码的网页服务器,是目前世界上使用最广泛的一种web server,它以跨平台,高效和稳定而闻名,可以运行在几乎所有广泛使用的计算机平台上。Apache的特点是简单、速度快、性能稳定,并可做代理服务器来使用。
  • Apache是用C语言开发的基于模块化设计的web应用,总体上看起来代码的可读性高于php代码,它的核心代码并不多,大多数的功能都被分割到各种模块中,各个模块在系统启动时按需载入。
  • 支持SSL技术,支持多个虚拟主机。Apache是以进程的Prefork模式(还有基于线程的Worker模式)为基础的结构,进程要比线程消耗更多的系统开支,不太适合于多处理器环境,因此,在一个Apache Web站点扩容时,通常是增加服务器或扩充群集节点而不是增加处理器。

2.Apache的特性

  1. 几乎可以运行在所有的计算机平台上.
  2. 支持最新的http/1.1协议
  3. 简单而且强有力的基于文件的配置(httpd.conf).
  4. 支持通用网关接口(cgi)
  5. 支持虚拟主机.
  6. 支持http认证.
  7. 集成perl.
  8. 集成的代理服务器
  9. 可以通过web浏览器监视服务器的状态, 可以自定义日志.
  10. 支持服务器端包含命令(ssi).
  11. 支持安全socket层(ssl).
  12. 具有用户会话过程的跟踪能力.
  13. 支持fastcgi

二、安装Apache服务

1.编译安装http服务

软件包下载:链接

[root@http ~]# yum install gcc -y   
[root@http ~]# tar xf httpd-2.2.27.tar.gz 
[root@http ~]# yum install zlib-devel -y 
[root@http ~]# cd httpd-2.2.27 
[root@http httpd-2.2.27]#./configure \
--prefix=/usr/local/apache \       #指定安装目录
--with-apr=/usr/local/apr \   #指定依赖文件的安装目录
--with-apr-util=/usr/local/apr-util \ #指定依赖文件的安装目录
--enable-deflate \               #压缩文本文件提高速度节约带宽
--enable-expires \               #让浏览器缓存,减轻服务器压力,提高访问速度
--enable-headers \              #激活http头
--enable-modules=most \         #激活大多数模块
--enable-so \                  #让apache核心装载DSO,但是不实际编译任何动态模块;
--with-mpm=worker \           #让Apache工作在worker模式下
--enable-rewrite                 #激活伪静态功能 
[root@http httpd-2.2.27]#make && make install
[root@http httpd-2.2.27]#ln -s /application/apache2.2.27/ /application/apache

2.启动服务

[root@http httpd-2.2.27]# cd
[root@http ~]# /application/apache/bin/apachectl start
httpd: apr_sockaddr_info_get() failed for http
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[root@http ~]# netstat -lntup|grep 80
tcp        0      0 :::80                       :::*                        LISTEN      69045/httpd 

3.关闭防火墙,se

[root@http ~]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]
[root@http ~]# setenforce 0

4.通过网页查看

这里写图片描述

4.1修改首页内容

[root@http ~]# cat /application/apache/htdocs/index.html   
<html><body><h1>hello httpd!</h1></body></html>

4.2网页查看

这里写图片描述

猜你喜欢

转载自blog.csdn.net/liang_operations/article/details/81390437