linux搭建简易网站

1、检查环境

getenforce                          #查看seLinux运行状态
Enforcing                           #强行执行
setenforce 0                        #临时关闭selinux
vim /etc/selinux/config             #编辑selinux配置文件
###########
将SELINUX=enforcing改为
SELINUX=disabled
###########

2、临时关闭防火墙

(因为在实际应用时不能关闭防火墙,因此此时暂时关闭防火墙)

systemctl stop firewalld       #临时关闭防火墙
systemctl disable firewalld     #禁止防火墙开机启动

3、配置yum源

mkdir /iso                  #创建挂载点
mount /dev/cdrom /iso       #挂载光盘到挂载点
df -h                       #查看挂载是否成功

cd /etc/yum.repos.d/     #进入yum源目录
rm -rf *.repo            #删除官方源
vim iso.repo             #编辑源文件
##############
[iso]                    #源标示
name=iso                 #源名称
baseurl=file:///iso      #源地址    file:// +  /iso
enabled=1                #开启源          
gpgcheck=0               #关闭验证
##############
yum clean all            #清理Yum源缓存

4.安装服务

yum -y install httpd                             #安装httpd服务
rm -rf /etc/httpd/conf.d/welcome.conf            #删除欢迎页

5.启动服务

rm -rf /etc/httpd/conf.d/welcome.conf        #删除欢迎页
systemctl start httpd                        #启动httpd
systemctl enable httpd                       #设置httpd开机启动
ip a                                         #查看本机IP

浏览器画面:

6.编辑主页

curl www.XXX.com > /var/www/html/index.html   #把某个网站的内容加入到index页面
vim   /var/www/html/index.html          #修改里边的内容

 

 

 

作者:无荨

-------------------------------------------

个性签名:学IT,就要做到‘活到老学到老’!

如果觉得这篇文章对你有小小的帮助的话,别忘记点个“推荐”哦!

原文地址:https://www.cnblogs.com/twoo/p/11611576.html