1、CentOS6中简单的web站点的配置实例:
1.安装httpd:
~]# yum install -y httpd httpd-manual httpd-tools //安装httpd应用程序所须要的必要文档文件
2.确保SElinux和iptables防火墙不会干扰httpd服务的提供:
SElinux配置:
~]# getenforce //查看SELinux状态
Enforcing
~]# setenforce 0 //设置SELinux为
防火墙:
~]# iptables -vnL //查看主机是否防火墙状态
其执行结果中若是有防火墙规则如图:
,就须要进行以下处理:
~]# service iptables stop //中止防火墙服务,仅限于实验环境关闭
~]# chkconfig iptables off //设置防火墙服务开机自启关闭
~]# iptables -F //清除全部规则来暂时中止防火墙 (只适合在没有配置防火墙的环境中,若是已经配置过默认规则为deny的环境,此步骤将使系统的全部网络访问中断)
3.添加一个html文档:/var/www/html/index.html
4.启动httpd服务
~]# service httpd start
5.监测服务启动是否正常:
~]# ss -tnl | grep httpd //监听端口号,查看httpd服务是否开启,通常默认是80
~]# ps aux | grep httpd //查看进程是否有httpd进程启用
~]# service httpd status //查看httpd服务的状态
6.设置httpd服务开机自动启动:
~]# chkconfig httpd on
7.在本地客户端主机访问建立好的IP地址就能够了:html
2、CentOS7中简单的web站点的配置实例:
1.安装httpd:
~]# yum install -y httpd httpd-manual httpd-tools
2.确保SElinux和iptables防火墙不会干扰httpd服务的提供:
SElinux配置:
~]# getenforce
Enforcing
~]# setenforce 0
防火墙:
~]# iptables -vnL
其执行结果中若是有防火墙规则以下图:
,须要进行以下处理:
~]# systemctl disable firewalld.service //中止防火墙
~]# systemctl stop firewalld.service //禁用防火墙
~]# iptables -F ////清除全部规则来暂时中止防火墙 (只适合在没有配置防火墙的环境中,若是已经配置过默认规则为deny的环境,此步骤将使系统的全部网络访问中断)
3.添加一个html文档:/var/www/html/index.html
4.启动httpd服务:
~]# systemctl start httpd
5.监测服务启动是否正常:
~]# ss -tnl | grep httpd
~]# ps aux | grep httpd
~]# systemctl status httpd.service
6.设置httpd服务开机自动启动:
~]# systemctl enable httpd.service
7.在本地客户端主机访问建立好的IP地址就能够了:linux