首页 > 系统相关 >linux搭建web服务

linux搭建web服务

时间:2023-01-12 17:33:31浏览次数:58  
标签:web httpd 防火墙 etc iso conf linux yum 搭建

​​

1、检查环境

getenforce                          #查看seLinux运行状态

Enforcing                           #强行执行

setenforce 0                        #临时关闭selinux

vim /etc/selinux/config             #编辑selinux配置文件

###########

将SELINUX=enforcing改为

SELINUX=disabled

###########

linux搭建web服务_html

2、临时关闭防火墙

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


systemctl stop firewalld       #临时关闭防火墙

systemctl disable firewalld     #禁止防火墙开机启动

linux搭建web服务_html_02

3、配置yum源

mkdir /iso                  #创建挂载点

mount /dev/cdrom /iso       #挂载光盘到挂载点

df -h                       #查看挂载是否成功

linux搭建web服务_web_03

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            #删除欢迎页

linux搭建web服务_html_04

5.启动服务

rm -rf /etc/httpd/conf.d/welcome.conf        #删除欢迎页

systemctl start httpd                        #启动httpd

systemctl enable httpd                       #设置httpd开机启动

ip a                                         #查看本机IP

linux搭建web服务_web_05

浏览器画面:

linux搭建web服务_html_06

6.编辑主页

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

vim   /var/www/html/index.html          #修改里边的内容



 

标签:web,httpd,防火墙,etc,iso,conf,linux,yum,搭建
From: https://blog.51cto.com/u_13562306/6004539

相关文章