题目
在rhel8的系统上搭建网站:该网站ip地址主机位为11,设置documentroot为/www/你的名字拼音的缩写,网页内容为:my name is…
步骤
# 下载httpd服务包
[root@localhost www]# yum install httpd -y
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered with an entitlement server. You can use subscription-manager to register.
Last metadata expiration check: 2:13:53 ago on Fri 11 Nov 2022 10:42:46 PM EST.
Package httpd-2.4.37-43.module_el8.5.0+1022+b541f3b1.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
# 建立目录
[root@localhost certs]# mkdir -pv /www/linboan
# 写入内容进入index.html
[root@localhost www]# echo my name is linboan > /www/linboan/index.html
[root@localhost www]# cd /etc/httpd/conf.d
# 写入规则
[root@localhost conf.d]# vim linboan.conf
<VirtualHost 192.168.182.11:80>
DocumentRoot "/www/linboan"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "/www/linboan/com-error_log"
CustomLog "/www/linboan/com-access_log" common
</VirtualHost>
<directory "/www">
Allowoverride none
Require all granted
</directory>
# 关闭防火墙,selinux
# 重启httpd服务
[root@localhost conf.d]# systemctl stop firewalld
[root@localhost conf.d]# setenforce 0
[root@localhost conf.d]# systemctl restart httpd
# 测试
[root@localhost conf.d]# curl 192.168.182.11
my name is linboan