掃二維碼與項目經(jīng)理溝通
我們在微信上24小時期待你的聲音
解答本文疑問/技術(shù)咨詢/運營咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流
Apache是目前世界上使用最廣泛的一種web server,它以跨平臺,高效和穩(wěn)定而聞名,可以運行在幾乎所有廣泛使用的計算機平臺上,本篇文章重點為大家講解一下CentOS下部署Apache服務(wù)具體方法。

凌海網(wǎng)站制作公司哪家好,找創(chuàng)新互聯(lián)公司!從網(wǎng)頁設(shè)計、網(wǎng)站建設(shè)、微信開發(fā)、APP開發(fā)、響應(yīng)式網(wǎng)站設(shè)計等網(wǎng)站項目制作,到程序開發(fā),運營維護。創(chuàng)新互聯(lián)公司從2013年成立到現(xiàn)在10年的時間,我們擁有了豐富的建站經(jīng)驗和運維經(jīng)驗,來保證我們的工作的順利進行。專注于網(wǎng)站建設(shè)就選創(chuàng)新互聯(lián)公司。
編譯安裝前首先yum 安裝“開發(fā)環(huán)境”“兼容庫”“中文支持”即執(zhí)行如下命令
#yum groupinstall "Development tools" "Compatibility libraries" "Chinese Support [zh]" -y
安裝man, vim, wget 工具
#yum install man vim wget -y
因為這次要編譯安裝httpd2.4.25,此版本需要更高版本的apr和apr-util。
因此要首先編譯安裝apr和apr-util。
wget http://mirrors.hust.edu.cn/apache/apr/apr-1.5.2.tar.bz2
wget http://mirrors.hust.edu.cn/apache/apr/apr-util-1.5.4.tar.bz2
tar xf apr-1.5.2.tar.bz2
cd apr-1.5.2
./configure --prefix=/usr/local/apr
echo $? ###如果執(zhí)行結(jié)果是0,則繼續(xù)執(zhí)行make && make install
tar xf apr-util-1.5.4.tar.bz2
cd apr-util-1.5.4
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
echo $? ###如果執(zhí)行結(jié)果是0,則繼續(xù)執(zhí)行make && make install
wget http://mirrors.hust.edu.cn/apache/httpd/httpd-2.4.25.tar.bz2
多次編譯經(jīng)驗得知,缺少pcre相關(guān)文件,openssl is too old
執(zhí)行如下命令:
yum install pcre-devel openssl openssl-devel -y
tar xf httpd-2.4.25
cd httpd-2.4.25
./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/
CentOS 6.5上編譯安裝Apache服務(wù)器的方法(最小化安裝)
有如上提示則繼續(xù)執(zhí)行:make && make install
再執(zhí)行echo$?如果結(jié)果是0,則說明httpd2.4.25到此編譯成功,然后進行簡單的配置,就可以使用了
關(guān)閉linux防火墻
service httpd stop
關(guān)閉SELinux
setenforce 0
復(fù)制啟動文件
cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
把httpd的環(huán)境變量添加到“環(huán)境變量”
echo 'export PATH=$PATH:/usr/local/apache/bin' > /etc/profile.d/httpd.sh
chmod +x /etc/profile.d/httpd.sh
source /etc/profile.d/httpd.sh
編輯httpd的配置文件:
vim /etc/httpd/httpd.conf
在ServerRoot下一行,添加 ServerName localhost
如果想把Apache服務(wù)加入到開機啟動,可以修改服務(wù)啟動腳本:
vim /etc/init.d/httpd
在第二行下添加:
# chkconfig:235 85 15
# description: This is apache server
保存退出
執(zhí)行命令
service httpd start
#提示lynx找不到???那就
yum install lynx -y
執(zhí)行命令
netstat -ntlp
#查看httpd是否啟動,是否有80端口 最后在你的瀏覽器輸入虛擬機IP地址
It works!
則Apache,安裝成功
1、編譯安裝–默認的index.html首頁在
/usr/local/apache/htdocs
2、配置文件:
/etc/httpd/httpd.conf
3、啟動腳本:
/etc/init.d/httpd
4、cgi-bin文件目錄:
/etc/local/apache/cgi-bin

我們在微信上24小時期待你的聲音
解答本文疑問/技術(shù)咨詢/運營咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流