第一步:yum install httpd -y #安裝httpd服務

第二步:systemctl start httpd #啟動httpd服務

第三步:systemctl enable httpd #設置httpd服務為開機啟動

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

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

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

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

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