1.默认http访问界面
关闭防火墙
[[email protected] ~]# systemctl stop firewalld.service
关闭selinux
[[email protected] ~]# setenforce 0
挂载
[[email protected] ~]# mount /dev/sr0 /mnt
mount: /dev/sr0 is write-protected, mounting read-only
编辑yum源
[[email protected] ~]# vim /etc/yum.repos.d/base.repo
[base]
name=base
baseurl=file:///mnt
enable=1
gpgcheck=0
安装httpd包
[[email protected] ~]# yum install httpd -y
......直到出现
Dependency Installed:
apr.x86_64 0:1.4.8-3.el7 apr-util.x86_64 0:1.5.2-6.el7 httpd-tools.x86_64 0:2.4.6-67.el7
Complete!
启动http服务
[[email protected] ~]# systemctl start httpd
此时查看http服务的状态,报错
Mar 19 00:12:15 catyuan.localdomain httpd[42291]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using catyuan.localdomain. Set the 'ServerName' directive globally to suppress this message
无法可靠地确定服务器的完全限定域名。
在/etc/httpd/conf/httpd.conf文件中修改第95行, 去掉注释ServerName www.example.com:80
[[email protected] ~]# vim /etc/httpd/conf/httpd.conf
进入配置文件后 :set nu显示行号
第95行:ServerName 0.0.0.0:80
重启http服务
[[email protected] ~]# systemctl restart httpd.service
浏览器中输入IP地址,显示如下界面,则表示安装成功
2http访问静态页面
http默认的网站根目录是/var/www/html/,使用echo命令写入内容
[[email protected] ~]# echo this is test > /var/www/html/index.html
此时刷新浏览器