centos7下www安装与配置
时间: 2023-12-08 09:37:58 浏览: 162
以下是在CentOS 7下安装和配置DNS的步骤:
1.安装DNS
```shell
yum install -y bind bind-utils
```
2.配置主配置文件/etc/named.conf
```shell
vi /etc/named.conf
```
在options块中添加以下内容:
```
listen-on port 53 { any; };
allow-query { any; };
```
在zone块中添加以下内容:
```
zone "lml.com" IN {
type master;
file "lml.com.zone";
allow-update { none; };
};
zone "192.168.159.in-addr.arpa" IN {
type master;
file "159.168.192.zone";
allow-update { none; };
};
```
3.配置正向解析配置文件/var/named/lml.com.zone
```shell
vi /var/named/lml.com.zone
```
添加以下内容:
```
$TTL 86400
@ IN SOA ns1.lml.com. root.lml.com. (
2011071001 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)
@ IN NS ns1.lml.com.
ns1 IN A 192.168.159.130
www IN A 192.168.159.130
```
4.配置反向解析配置文件/var/named/159.168.192.zone
```shell
vi /var/named/159.168.192.zone
```
添加以下内容:
```
$TTL 86400
@ IN SOA ns1.lml.com. root.lml.com. (
2011071001 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)
@ IN NS ns1.lml.com.
130 IN PTR www.lml.com.
```
5.启动DNS服务并设置开机自启动
```shell
systemctl start named
systemctl enable named
```
6.关闭防火墙和SELinux
```shell
systemctl stop firewalld && setenforce 0
```
阅读全文