安装Apache

一、软件下载
1. Apache HTTP Server
地址:http://httpd.apache.org/download.cgi#apache24
2. APR 和 APR-Util
地址:http://apr.apache.org/download.cgi
3. PCRE
地址:https://sourceforge.net/projects/pcre/files/pcre/

二、安装gcc
yum install gcc-c++

三、新建目录
mkdir /home/admin/basics/http/httpd
mkdir /home/admin/basics/http/apr
mkdir /home/admin/basics/http/apr-util
mkdir /home/admin/basics/http/pcre

四、解压包
cd /home/admin/basics/http/
tar -zxf apr-1.5.2.tar.gz
tar -zxf apr-util-1.5.4.tar.gz
tar -zxf pcre-8.38.tar.gz
tar -zxf httpd-2.4.18.tar.gz

五、安装
cd /home/admin/basics/http/
cd apr-1.5.2
./configure –prefix=/home/admin/basics/http/apr
make
make install

cd /home/admin/basics/http/
cd apr-util-1.5.4
./configure –prefix=/home/admin/basics/http/apr-util –with-apr=/home/admin/basics/http/apr/bin/apr-1-config
make
make install

cd /home/admin/basics/http/
cd pcre-8.38
./configure –prefix=/home/admin/basics/http/pcre –with-apr=/home/admin/basics/http/apr/bin/apr-1-config
make
make install

cd /home/admin/basics/http/
cd httpd-2.4.18
./configure –prefix=/home/admin/basics/http/httpd –with-pcre=/home/admin/basics/http/pcre –with-apr=/home/admin/basics/http/apr –with-apr-util=/home/admin/basics/http/apr-util
make
make install

YUM安装
##先yum list看看有没有你可以的包
yum list httpd

##如果有的话,比如我用x86_64版,就可以安装
yum install httpd.x86_64

配置、启动Apache
httpd.conf是主配置文件,你可以按需更改,一般来说可能需要自定义端口,那么就vim修改httpd.conf文件的监听端口,改为你希望的 

启动、关闭、重启
./apachectl start
./apachectl stop
./apachectl restart

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2018年4月20日
下一篇 2018年4月20日

相关推荐