安裝環(huán)境:Centos7.6
? 下載鏈接沒用了都述么,自己找吧擅耽,實在不行打毛,直接最新版司恳,不過網(wǎng)卡配置有點煩途乃,搞8版本的話
? http://centos.hbcse.tifr.res.in/centos/7.6.1810/isos/x86_64/?? //找到一個能用的(補上)
一、卸載已經(jīng)安裝的httpd服務(wù)(新機器可無視)
????????? rpm -e httpd --nodeps
二扔傅、下載安裝包耍共,需要Linux上網(wǎng),當(dāng)然也可以先在官網(wǎng)下載Apache的Linux版本猎塞,在傳到Linux系統(tǒng)中
????? httpd-2.4.43.tar.bz2 我是去Apache官網(wǎng)找的试读,鏈接都炸掉了,很煩
????? yum install wget -y? //安裝下載工具
?????? yum -y install gcc gcc++ zlib zlib-devel pcre-devel binutils glibc openssl-devel?
???????? //搞得有點多邢享,以后基本編譯啥都不用安環(huán)境了
????? 下載一下依賴包鹏往,啥?你說依賴包干啥的骇塘,好像是移植不同系統(tǒng)用的伊履,這不是重點啦
????? wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.6.5.tar.gz
? ? ? wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.6.1.tar.gz
???????? tar zxvf httpd-2.4.43.tar.bz2 -C /opt/?????? //習(xí)慣解壓到/opt下面
???????? tar xf apr-1.6.5.tar.gz -C /opt/
???????? tar xf apr-util-1.6.1.tar.gz -C /opt/
三、編譯款违,安裝
????? cd /opt/
?????? mv apr-1.6.5/ httpd-2.4.43/srclib/apr
? ? ?? mv apr-util-1.6.1/ httpd-2.4.43/srclib/apr-util
??????? cd httpd-2.4.43/
???????? ./configure \??????????????????? //預(yù)編譯一下
??????? ? ? --prefix=/usr/local/httpd \
??????? ?? --enable-so \
??????????? --enable-rewrite \
???????? ?? --enable-charset-lite \
??????????? --enable-cgi
???????? make && make install??? //編譯+安裝
四唐瀑、修改主配置文件,并加入systemctl管理
cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
vi /etc/init.d/httpd
# chkconfig: 35 85 21? ? ? ? ?//第2插爹,3行加入
# description: Apache is a World Wide Web server
chkconfig --add /etc/init.d/httpd
??? systemctl start httpd??? //可以通過你的web瀏覽器進行訪問啦
? ? systemctl status httpd? //查看httpd服務(wù)的狀態(tài)
? ? systemctl stop httpd? ?//關(guān)閉httpd服務(wù)
? ? systemctl? restart httpd? //重啟httpd服務(wù)
可以直接在瀏覽器訪問IP哄辣,獲取apache服務(wù)頁面,如果要修改赠尾,可以在/usr/local/httpd/htdocs/下修改