1、yum install httpd -y
在这里插入图片描述
2、安装好后启动httpd

systemctl start httpd   

查看httpd状态

systemctl status httpd

显示running是代表运行的意思,inactive代表未运行
在这里插入图片描述
3、启动之后可以通过浏览器访问主机ip地址
在这里插入图片描述
4、httpd服务配置文件和存放的目录
服务目录: /etc/httpd
主配置文件: /etc/httpd/conf/httpd.conf
网站数据目录: /var/www/html
访问日志: /var/log/httpd/access_log
错误日志:/var/log/httpd/error_log

5、使用vim 编辑主配置文件

vim /etc/httpd/conf/httpd.conf 

主配置文件说明
在这里插入图片描述在这里插入图片描述
需要修改网站数据目录,在主配置文件中将/var/www/html改成你想要的网站目录重启服务即可
在这里插入图片描述

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐