设置单实例Apache HTTP服务器
- 配置仓库
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# vi rpm.repo
仓库代码:
[BaseOS]
name=BaseOS
baseurl=/mnt/BaseOS
enabled=1
gpgcheck=0
[AppStream]
name=AppStream
baseurl=/mnt/AppStream
enabled=1
gpgcheck=0
- 挂载
[root@localhost yum.repos.d]# mount /dev/sr0 /mnt/
mount: /mnt: WARNING: source write-protected, mounted read-only.
- 安装httpd软件包
[root@localhost yum.repos.d]# dnf install httpd -y
显示Complete!安装成功
- 启动服务
[root@localhost yum.repos.d]# systemctl start httpd
- 关闭防火墙
[root@localhost yum.repos.d]# systemctl stop firewalld
- 给网页写内容
[root@localhost yum.repos.d]# echo welcome to hahahhaha > /var/www/html/index.html
- 在浏览器中输入网址进行访问
- 进入
etc/httpd/conf.d
目录,编辑vhost.conf
配置文件
<directory /www>
allowoverride none
require all granted
</directory>
<virtualhost 192.168.209.136:80>
documentroot /www
servername 192.168.209.136
</virtualhost>
- 创建
/www
目录
[root@localhost conf.d]# mkdir /www
- 写内容到
/www/index.html
访问测试
[root@localhost conf.d]# echo welcome to xixi > /www/index.html
- 重启httpd服务
[root@localhost conf.d]# systemctl restart httpd
- 关闭防火墙
[root@localhost conf.d]# systemctl stop firewalld
- 关闭SELinux
[root@localhost conf.d]# setenforce 0
- 进入浏览器访问
原文地址:https://blog.csdn.net/qq_65017742/article/details/140201911
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!