1、服务器系统: centos 系统, 我的系统是最小化安装有的软件包没有需要在安装
2、安装需要软件包:yum install compat-libstdc cpp gcc libstdc -devel gcc-c e2fsprogs-devel zlib-devel krb5-devel openssl-devel -y
3、下载 apache 源包地址:
4、解压下载文件:tar zxvf httpd-2.4.3.tar.gz
5、进入目录: cd httpd-2.4.3
6、配置文件参数, 此操作把mysql 安装到了 /usr/local/apache 目录下:
./configure --prefix=/usr/local/apache \
--enable-ssl=static \
--enable-module=so \
--enable-module=rewrite \
--enable-mods-shared=all \
--enable-track-vars \
--with-ssl=/usr/share/ssl \
--with-z=/usr/include/ \
--with-mpm=worker \
--enable-suexec \
--enable-cgi \
--enable-cgid \
--enable-vhost-alias \
--enable-speling \
--enable-mime-magic \
--enable-headers \
--enable-usertrack \
--enable-unique-id \
--enable-deflate \
--enable-headers \
--enable-auth-digest
7、如果没有错误 就执行
make
make install
8、测试 apache
/usr/local/apache/bin/apachectl configtest
若显示syntax ok则表明安装成功
9、做一个软连接,以后容易操作:
ln -s /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd
10、vim /usr/local/apache/conf/httpd.conf
把 directoryindex index.html index.html.var 修改成; directoryindex index.php index.html index.html.var
添加:
addtype application/x-httpd-php .php
addtype application/x-httpd-php-source .phps
11、设置自启动
vim /etc/rc.local
添加:service httpd start
12、启动 apache 命令:
/etc/init.d/httpd start
13、停止 apache 命令:
/etc/init.d/httpd stop
14、用ie访问看是否成功
地址
15、如果启动apache 出现 httpd: could not determine the server's fully qualified domain name, using 127.0.0.1 for servername 的错误
打开 apache 配置文件:
vim /usr/local/apache/conf/httpd.conf
查找 servername 修改成 servername localhost:80
如果前面有 #, 修改后 把 #去掉
阅读(2083) | 评论(0) | 转发(2) |