CentOS7安裝apache httpd服務

來源:互聯網
上載者:User

標籤:apache   httpd   

 虛擬機器:192.168.2.21    
 【停止防火牆】
   sudo systemctl stop firewalld.service      --停止防火牆
   sudo systemctl disable firewalld.service   --開機關閉防火牆
   
 【安裝apache httpd服務】
   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服務
   sudo systemctl list-unit-files httpd.service    --查看httpd服務
   sudo systemctl enable  httpd.service && sudo systemctl start httpd.service  --啟動httpd服務
   sudo systemctl -l status  httpd.service         --查看httpd服務
   sudo netstat -tpnl            --查看httpd服務佔用連接埠
   curl http://localost          --測試httpd是否安裝成功
   curl http://127.0.0.1         --測試httpd是否安裝成功
   curl http://192.168.2.21              --測試httpd是否安裝成功
   sudo systemctl -l status firewalld.service      --查看防火牆狀態
   sudo systemctl stop firewalld.service           --停止防火牆
   sudo systemctl disable firewalld.service        --開機關閉防火牆
   
   ls /var/www/html                                 --這是封裝的http訪問的入口
   sudo ln -s /home/ecp2/mirror/ /var/www/html/     --在/var/www/html下建立/home/ecp2/mirror 目錄的 捷徑 但由於許可權的問題 這種操作訪問不了
   sudo chown -R apache: mirror/                    --將檔案mirror檔案的讀許可權給apache使用者 (這樣依然沒有許可權訪問)
   sudo cp -r /home/ecp2/mirror .                   --把/home/ecp2/mirror鏡像目錄複寫到.目前的目錄 即/var/www/html (這樣在瀏覽器http://192.168.2.21/mirror 就可以訪問了)
 

CentOS7安裝apache httpd服務

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.