分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 技术分享

CentOS6和CentOS7中简单web站点的配置步骤

发布时间:2023-09-06 01:51责任编辑:熊小新关键词:配置
一、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 ??????????????????????????

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地址就可以了:

二、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
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地址就可以了。

CentOS6和CentOS7中简单web站点的配置步骤

原文地址:http://blog.51cto.com/chenliangdeeper/2108738

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved