如何在centos8系统中,利用httpd搭建本地web服务器.
1. 安装httpdsudo yum install -y httpd
2.启动服务service httpd start
3.设置开机启动
先检查一下,有没有设置开机启动:systemctl list-unit-files | grep httpd
如果没有的话输入一下命令:chkconfig httpd on
再来确认一下有没有设置开机启动成功:systemctl list-unit-files | grep httpd
4.访问
在浏览器输入内网ip地址.若出现以下页面则表示成功.
5.如何修改默认主页
网站的默认主页根目录位于/var/www/html下,可以通过修改/etc/httpd/conf/httpd.conf修改.这里只是修改主页.在/var/www/html创建一个index.html:cd /var/www/html
sudo vim index.htm
把你的HTML代码输入进去,然后刷新在浏览器就可以了.