溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

CentOS7安裝apache httpd服務(wù)

發(fā)布時間:2020-07-24 20:35:20 來源:網(wǎng)絡(luò) 閱讀:977 作者:fei_0123456789 欄目:開發(fā)技術(shù)

 虛擬機:192.168.2.21    
 【停止防火墻】
   sudo systemctl stop firewalld.service      --停止防火墻
   sudo systemctl disable firewalld.service   --開機關(guān)閉防火墻
   
 【安裝apache httpd服務(wù)】
   cat /etc/yum.repos.d/CentOS-Media.repo   -----查看鏡像配置
   yum --disablerepo=\* --enablerepo=c7-media,offline-extras,offline-storage-gluster38 list | grep httpd       --查看本地鏡像是否有 apache httpd 的rpm安裝包
   sudo yum --disablerepo=\* --enablerepo=c7-media,offline-extras,offline-storage-gluster38 install httpd      --安裝httpd服務(wù)
   sudo systemctl list-unit-files httpd.service    --查看httpd服務(wù)
   sudo systemctl enable  httpd.service && sudo systemctl start httpd.service  --啟動httpd服務(wù)
   sudo systemctl -l status  httpd.service         --查看httpd服務(wù)
   sudo netstat -tpnl            --查看httpd服務(wù)占用端口
   curl http://localost          --測試httpd是否安裝成功
   curl http://127.0.0.1         --測試httpd是否安裝成功
   curl http://192.168.2.21              --測試httpd是否安裝成功
   sudo systemctl -l status firewalld.service      --查看防火墻狀態(tài)
   sudo systemctl stop firewalld.service           --停止防火墻
   sudo systemctl disable firewalld.service        --開機關(guān)閉防火墻
   
   ls /var/www/html                                 --這是封裝的http訪問的入口
   sudo ln -s /home/ecp2/mirror/ /var/www/html/     --在/var/www/html下創(chuàng)建/home/ecp2/mirror 目錄的 快捷方式 但由于權(quán)限的問題 這種操作訪問不了
   sudo chown -R apache: mirror/                    --將文件mirror文件的讀權(quán)限給apache用戶 (這樣依然沒有權(quán)限訪問)
   sudo cp -r /home/ecp2/mirror .                   --把/home/ecp2/mirror鏡像目錄復(fù)制到.當(dāng)前目錄 即/var/www/html (這樣在瀏覽器http://192.168.2.21/mirror 就可以訪問了)
 

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI