標籤: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服務