一学就会的简单网站搭建

1.安装httpd,并将访问apache服务器的首页修改为hello.html, 且内容为: "My Home Page is hello"

安装httpd :yum install httpd -y

[root@localhost ~]# yum install httpd -y

[root@localhost ~]# systemctl status firewalld       #查看防火墙状态
[root@localhost ~]# systemctl stop firewalld         # 关闭防火墙

[root@localhost conf]# cd /var/www/html

[root@localhost html]# vim hello.html

 [root@localhost html]#systemctl restart httpd

这里还需要将其改名
[root@localhost html]# mv hello.html index.html
 [root@localhost html]# systemctl restart httpd

网页输入ip

 


2.虚拟主机:虚拟两台主机ip为100,200, 对应访问目录:/www/ip/100, /www/ip/200
            并创建首页文件index.html 

 

 

 


3.配置不同端口的虚拟主机访问apache服务器

[root@localhost conf.d]# mkdir /www/port/{9090,9091}-p

[root@localhost conf.d]# echo "this is 9090" > /www/port/9090/index.html

[root@localhost conf.d]# echo "this is 9091" > /www/port/9091/index.html

[root@localhost conf.d]# vim myhost.conf

 

[root@localhost conf.d]#systemctl restart httpd

然后通过ip访问网站(后面为端口)

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值