1.apache下载 http://httpd.apache.org/download.cgi
2.apache编译
mkdir –p /usr/local/apache2.4 //在这个目录下建立文档,利于管理
tar –xvf httpd-2.4.46.tar.gz //解压
cd httpd-2.4.46 //进入
./configure --prefix=/usr/local/apache2.4 --enable-shared=max --enable-module=rewirte --enable-module=so
make
make install
service httpd start //开启httpd服务
3.测试 浏览器中输入ip地址,显示it works,则表示Apahce安装并启动成功
问题解决方法
//顺利步骤如上,编译apache过程中会报错,需要下载对应的文件
网站 https://www.cnblogs.com/xiaoyaowuming/p/5945981.html
apr相关下载
http://apr.apache.org/download.cgi
configure: error: APR not found. Please read the documentation.
安装apr
tar -xvf xxx.tar.gz -C /opt
cd /opt/xxx
./configure --prefix=/usr/local/apr
make
make install
configure: error: APR-util not found. Please read the documentation.
安装apr-util
./configure --prefix=/usr/local/apr-util -with-apr=/usr/local/apr
make
make install
../configure仍提示APR-util not found
1 增加--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
配置apache
参考:https://blog.youkuaiyun.com/dmt742055597/article/details/78483654
配置conf
安装mod_ssl.o
从源码包中把将modules下的loggers,ssl两个文件【一定是两个文件否则出错】放到服务器端apache的modules下
cd到服务端的modules/ssl目录;执行命令: apxs -i -c -a -D HAVE_OPENSSL=1 -I /usr/include/openssl -lcrypto -lssl -ldl *.c 即可
提示未安装apxs,实际上源码安装时在 ../bin/目录下有apxs,需要指定
/usr/local/apache2.4/bin/apxs -i -c -a -D HAVE_OPENSSL=1 -I /usr/include/openssl -lcrypto -lssl -ldl *.c
又报没有mod_md.h文件
进入源码包中的modules/md/文件夹中,将mod_md.h 拷贝到 /usr/local/apache2.4/modules/ssl中
/usr/local/apache2.4/bin/apxs -i -c -a -D HAVE_OPENSSL=1 -I /usr/include/openssl -lcrypto -lssl -ldl *.c
提示没有mod_fcgid.so
下载http://httpd.apache.org/download.cgi#mod_fcgid
解压,进入目录
APXS=/usr/local/apache2.4/bin/apxs ./configure.apxs
make
make install