CentOS6和CentOS7中簡單web站點的配置步驟

1、CentOS6中簡單的web站點的配置實例:
1.安裝httpd:
~]# yum install -y httpd httpd-manual httpd-tools //安裝httpd應用程序所須要的必要文檔文件
CentOS6和CentOS7中簡單web站點的配置步驟
2.確保SElinux和iptables防火牆不會干擾httpd服務的提供:
SElinux配置:
~]# getenforce //查看SELinux狀態
Enforcing
~]# setenforce 0 //設置SELinux爲
CentOS6和CentOS7中簡單web站點的配置步驟
防火牆:
~]# iptables -vnL //查看主機是否防火牆狀態
其執行結果中若是有防火牆規則如圖:
CentOS6和CentOS7中簡單web站點的配置步驟
,就須要進行以下處理:
~]# service iptables stop //中止防火牆服務,僅限於實驗環境關閉
~]# chkconfig iptables off //設置防火牆服務開機自啓關閉
~]# iptables -F //清除全部規則來暫時中止防火牆 (只適合在沒有配置防火牆的環境中,若是已經配置過默認規則爲deny的環境,此步驟將使系統的全部網絡訪問中斷)
CentOS6和CentOS7中簡單web站點的配置步驟
3.添加一個html文檔:/var/www/html/index.html
CentOS6和CentOS7中簡單web站點的配置步驟
4.啓動httpd服務
~]# service httpd start
CentOS6和CentOS7中簡單web站點的配置步驟
5.監測服務啓動是否正常:
~]# ss -tnl | grep httpd //監聽端口號,查看httpd服務是否開啓,通常默認是80
~]# ps aux | grep httpd //查看進程是否有httpd進程啓用
~]# service httpd status //查看httpd服務的狀態
CentOS6和CentOS7中簡單web站點的配置步驟
6.設置httpd服務開機自動啓動:
~]# chkconfig httpd on
7.在本地客戶端主機訪問建立好的IP地址就能夠了:
CentOS6和CentOS7中簡單web站點的配置步驟html

2、CentOS7中簡單的web站點的配置實例:
1.安裝httpd:
~]# yum install -y httpd httpd-manual httpd-tools
CentOS6和CentOS7中簡單web站點的配置步驟
2.確保SElinux和iptables防火牆不會干擾httpd服務的提供:
SElinux配置:
~]# getenforce
Enforcing
~]# setenforce 0
CentOS6和CentOS7中簡單web站點的配置步驟
防火牆:
~]# iptables -vnL
其執行結果中若是有防火牆規則以下圖:
CentOS6和CentOS7中簡單web站點的配置步驟
,須要進行以下處理:
~]# systemctl disable firewalld.service //中止防火牆
~]# systemctl stop firewalld.service //禁用防火牆
~]# iptables -F ////清除全部規則來暫時中止防火牆 (只適合在沒有配置防火牆的環境中,若是已經配置過默認規則爲deny的環境,此步驟將使系統的全部網絡訪問中斷)
CentOS6和CentOS7中簡單web站點的配置步驟
3.添加一個html文檔:/var/www/html/index.html
CentOS6和CentOS7中簡單web站點的配置步驟
4.啓動httpd服務:
~]# systemctl start httpd
5.監測服務啓動是否正常:
~]# ss -tnl | grep httpd
~]# ps aux | grep httpd
~]# systemctl status httpd.service
CentOS6和CentOS7中簡單web站點的配置步驟
6.設置httpd服務開機自動啓動:
~]# systemctl enable httpd.service
CentOS6和CentOS7中簡單web站點的配置步驟
7.在本地客戶端主機訪問建立好的IP地址就能夠了:
CentOS6和CentOS7中簡單web站點的配置步驟linux

相關文章
相關標籤/搜索