Linux搭建Apache
1.安装APR,APR-util,PCRE,expat,gcc,gcc-c++的依赖
ARP和APR-util在http://apr.apache.org/download.cgi 这里下载
PCRE在https://pcre.org 这里下载
expat使用yum安装
yum install -y expat-devel*
gcc和gcc-c++使用yum安装
yum install gcc gcc-c++
2.下载apache安装包
apache在http://httpd.apache.org/download.cgi 这里下载
开始安装Apache
1.下载完上面的安装包和依赖包,上传到服务器(新建一个文件夹用来存放)
2.进入安装包目录解压
安装apr安装目录是/usr/local/apr
tar -zxf apr-1.7.0.tar
cd apr-1.7.0
./configure --prefix=/usr/local/apr
make && make install
安装apr-util安装目录是/usr/local/apr-util
tar -xf apr-util-1.6.1.tar
cd apr-util-1.6.1
./configure --prefix=/usr/local/apr-util -with-apr=/usr/local/apr/bin/apr-1-config
make && make install
安装pcre
tar -zxvf pcre-8.43.tar
cd pcre-8.43
./configure --prefix=/usr/local/pcre
make && make install
安装apache安装目录是/usr/local/apache
tar -zxvf httpd-2.4.41.tar
cd httpd-2.4.41
./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre --enable-module=so --enable-mods-shared=all --enable-module=rewirte --enable-cache --enable-file-cache --enable-mem-cache --enable-disk-cache --disable-cgid --disable-cgi
make && make install
修改httpd.conf
cd /usr/local/apache/conf/
vi httpd.conf
将ServerName前的“#”去掉,将www.example.com改成 本机IP:80(如192.168.1.1:80)
启动apache
cd /usr/local/apache/bin/
./apachectl start
通过本机浏览器输入地址