1、搭建一个通过网址https://www.openlab.com/money访问的缴费网站,网站内容为money
安装http和插件
[root@localhost ~]# dnf install httpd mod_ssl -y
OS 7.7 kB/s | 2.6 kB 00:00
everything 10 kB/s | 2.9 kB 00:00
EPOL 11 kB/s | 2.8 kB 00:00
debuginfo 11 kB/s | 2.8 kB 00:00
source 10 kB/s | 2.7 kB 00:00
update 12 kB/s | 3.1 kB 00:00
update-source 7.3 kB/s | 2.0 kB 00:00
Dependencies resolved.
=========================================================================================
Package Architecture Version Repository Size
=========================================================================================
Installing:
httpd x86_64 2.4.51-20.oe2203sp2 update 1.3
[root@localhost ~]# systemctl start httpd
[root@localhost ~]# systemctl enable httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
关闭防火墙
[root@localhost ~]# systemctl disable firewalld --now
[root@localhost ~]# systemctl restart nginx
Failed to restart nginx.service: Unit nginx.service not found.
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive
配置hosts文件
创建(www.openlab.com)网站
vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.179.137 www.openlab.com
创建网站对应的目录
[root@localhost ~]# mkdir -p /www/openlab
[root@localhost ~]# echo 'money' > /www/openlab/index.html
[root@localhost ~]# ls /www/openlab
index.html
编辑配置文件//重启服务器
[root@localhost ~]# vim /etc/httpd/conf.d/httpd.conf
<virtualhost 192.168.179.137>
documentroot /www/openlab
servername 'www.openlab.com'
<directory /www/openlab>
allowoverride none
require all granted
</directory>
</virtualhost>
[root@localhost ~]# systemctl start httpd
查看
[root@localhost ~]# curl 192.168.179.137
money
2、配置DNS的正向解析
[root@localhost ~]# vim /etc/named.conf
options {
listen-on port 53 { any; };
directory "/var/named";
zone "www.ceshi.com" IN {
type master;
file "named.www.ceshi.com";
};
[root@localhost ~]# vim /var/named/www.ceshi.com
$TTL 1D
@ IN SOA ns.ceshi.com admin.ceshi.com. ( 0 1D 1H 1W 3H )
IN NS ns.ceshi.com.
ns IN A 192.168.179.137
www IN A 192.168.179.137
[root@localhost ~]# systemctl restart named
关闭防火墙
root@localhost ~]# systemctl disable firewalld --now
查看
[root@localhost ~]# nslookup www.ceshi.com 192.168.179.137