1. dns
1.1 什么是dns(域名解析系统)
- 其实就是一个超大的网络电话簿dns就是域名解析到ip的一个过程,大型公司,用的dns服务名叫做bind软件
- 相当于一个域名于IP对应关系记录表
1.2 提供dns服务的公司
- 119.29.29.29 腾讯的
- 223.5.5.5 阿里的
- 223.6.6.6 阿里的
- 8.8.8.8 谷歌的
- 114.114.114.114 114公司的
1.3 安装bind-utils,查看dns解析的命令
yum install bind-utils
1.4 案例
# 查询dns解析的命令
nslookup api.0528.ltd
# 案例
[root@ymq yum.repos.d]# nslookup api.0528.ltd
Server: 223.5.5.5
Address: 223.5.5.5#53
Non-authoritative answer:
Name: api.0528.ltd
Address: 106.14.42.253
1.5 dns解析流程
- 浏览器首先在本地机器,操作系统dns缓存中查找是否有域名-ip的对应记录,
- 去/etc/hosts文件中寻找是否写死了域名解析记录,
- 如果hosts没写,就取/etc/resolv.conf配置文件中寻找dns服务器地址4,如果找到了对应的解析记录,就记录到本地dns缓存中
- /etc/ hosts本地强制dns的文件
- 大概图解
1.6 dns配置文件
linux的dns配置文件如下
里面定义了dns服务器地址
vim /etc/resolv.conf
2. yum安装软件
2.1 注意点
- 系统服务管理命令,只有通过yum安装的软件,才可以用系统服务管理命令
- 编译安装在 /opt/nginx112/ 无法使用 systemctl start nginx
- 如果是centos6就是 service nginx start
- 如果是centos7就是 systemctl start/stop/restart nginx
2.2 yum基础命令
yum search nginx
yum install nginx
yum remove nginx
2.3 yum安装nginx
2.3.1 换源
centos7.5换源https://blog.csdn.net/qq_52385631/article/details/123649099?spm=1001.2014.3001.5501
2.3.2 安装
yum install nginx -y
2.3.3 使用
常用命令
# 临时关闭防火请
iptables -F
(1) 启动:
systemctl start nginx
(3) 重启:
systemctl restart nginx
(4) 停止:
systemctl stop nginx
2.3.4 nginx基础配置
以下是Nginx的默认路径:
(1) Nginx配置路径:/etc/nginx/
(2) PID目录:/var/run/nginx.pid
(3) 错误日志:/var/log/nginx/error.log
(4) 访问日志:/var/log/nginx/access.log
(5) 默认站点目录:/usr/share/nginx/html
事实上,只需知道Nginx配置路径,其他路径均可在/etc/nginx/nginx.conf 以及/etc/nginx/conf.d/default.conf 中查询到。
2.3.4 彻底卸载nginx
停止Nginx软件
service nginx stop
删除Nginx的自动启动
chkconfig nginx off
从源头删除Nginx
rm -rf /usr/sbin/nginx
rm -rf /etc/nginx
rm -rf /etc/init.d/nginx
再使用yum清理
yum remove nginx
3. inux定时任务
分 时 日 月 周
* * * * * 所有命令一定要用绝对路径来写!
# 案例
# 每分钟执行一次命令
* * * * * 命令
# 每小时的3,15分组执行命令
3,15 * * * * 命令
# 在上午8-11点的第3和第15分钟执行
3,15 8-11 * * * 命令
# 每晚21:30执行命令
30 21 * * * 命令
# 每周六、日的1:30执行命令
30 1 * * 6,0 命令
# 每周一到周五的凌晨1点,清空/tmp目录的所有文件
0 1 * * 1-5 /usr/bin/rm -rf /tmp/*
# 每晚的21:30重启nginx
30 21 * * * /opt/nginx/sbin/nginx -s reload
# 每月的1,10,22日的4:45重启nginx
45 4 1,1,10,22 * * /opt/nginx/sbin/nginx -s reload
# 每个星期一的上午8点到11点的第3和15分钟执行命令
3,15 8-11 * * 1 command