1、下载源码包
wget http://mirrors.hust.edu.cn/apache/httpd-2.2.32.tar.gz
2、解压源码包
tar -zxvf httpd-2.2.32.tar.gz
3、创建一个安装目录
mkdir /usr/local/apache2
4、进入解压后的目录中,初始化安装环境:
#./configure\
--prefix=/usr/local/apache2\
--with-included-apr\
--enable-so\
--enable-deflate=shared\
--enable-expires=shared\
--enable-rewrite=shared\
--with-pcre\(正则相关的库)
5、编绎:make
6、安装:make install
7、启动服务:/usr/local/apache2/bin/apachectl start
查看apache 动态和静态的模块:
/usr/local/apache2/bin/apachectl -M
查看静态的模块:
/usr/local/apache2/bin/apachectl -l
检查配置文件是否有语法错误:
/usr/local/apache2/bin/apachectl -t
关闭:/usr/local/apache2/bin/apachectl stop
重启:/usr/local/apache2/bin/apachectl restart
只重新加载配置文件:
/usr/local/apache2/bin/apachectl graceful
./configure --help中 --with-mpm指定工作模式。
用浏览器打开虚拟机ip,有返回信息就说明web服务安装成功。
***防火墙要先关闭,才能在浏览器中访问。