共计 849 个字符,预计需要花费 3 分钟才能阅读完成。
如何从 CentOS 中源码编译和安装 Apache
1、下载最新的 Apache 版本
wget http://mirror.downloadvn.com/apache//httpd/httpd-2.4.41.tar.gz
2、安装软件包
yum install apr* gcc
3、编译安装
tar -zxvf httpd-2.4.41.tar.gz
cd httpd-2.4.41
./configure –prefix=/usr/local/apache –enable-vhost-alias –enable-rewrite –enable-info
make
make install
复制初始化文件并将 Apache 设置为启动
cp build/rpm/httpd.init /etc/init.d/httpd
chmod 755 /etc/init.d/httpd
chkconfig –add httpd
chkconfig –level 35 httpd on
创建一个符号链接
ln -s /usr/local/apache/ httpd
cd /usr/sbin/
ln -fs /usr/local/apache/bin/httpd
ln -fs /usr/local/apache/bin/apachectl
cd /var/log
rm -rf httpd/
/etc/init.d/httpd start
启动 / 停止 httpd 服务
service httpd restart
service httpd start
/usr/local/apache/bin/apachectl start
/usr/local/apache/bin/apachectl stop
/usr/local/apache/bin/apachectl status
/etc/init.d/httpd start
/etc/init.d/httpd stop
/etc/init.d/httpd restart
使用 pgrep 查找启动的进程
pgrep httpd
Apache 配置文件
vi /usr/local/apache/conf/httpd.conf
: