第一步:yum install httpd -y #安裝httpd服務(wù)

第二步:systemctl start httpd #啟動(dòng)httpd服務(wù)

第三步:systemctl enable httpd #設(shè)置httpd服務(wù)為開機(jī)啟動(dòng)

第四步:firewall-cmd --zone=public --add-port=80/tcp --permanent #開啟防火墻的80端口,并永久生效,返回success 設(shè)置成功的意思。(-permanent為永久生效,不加此參數(shù)重啟后失效)

第五步:systemctl restart firewalld.service #重啟防火墻使剛才的設(shè)置生效

第六步:firewall-cmd --zone=public --query-port=80/tcp #查看80端口是否開啟,返回yes開啟成功,返回no未開啟(設(shè)置完成不重啟防火墻會(huì)返回no)

第七步:把網(wǎng)站的源文件拷貝到/var/www/html目錄中 #或者把/var/www/html目錄刪除,然后把源文件目錄拷貝到/var/www目錄中改名html目錄,html目錄中要有index.html默認(rèn)首頁文件。

第八步:瀏覽器輸入本機(jī)IP地址測試 #域名的需要先申請域名,然后做域名解析,綁定公網(wǎng)IP后使用。
總結(jié)
到此這篇關(guān)于centos8使用Apache httpd2.4.37安裝web服務(wù)器的文章就介紹到這了,更多相關(guān)centos8使用Apache httpd2.4.37安裝web服務(wù)器內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!