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
如果前面有 #, 修改后 把 #去掉
阅读(543) | 评论(0) | 转发(0) |