在CentOs上部署nginx时会遇到时区的问题,有时候改完系统重启完还是会出错,so,需要配置成下面的NTP同步状态
[root@localhost ~]# timedatectl
Local time: Tue 2019-12-24 16:37:04 CST
Universal time: Tue 2019-12-24 08:37:04 UTC
RTC time: Tue 2019-12-24 16:37:04
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: yes
DST active: n/a
使用 date 命令,查看系统时间和当前时间是否一致,如果不一致,就需要使用ntp同步标准时间,ntp:网络时间协议(network time protol)
安装:yum install ntp
同步:ntpdate pool.ntp.org
查看下面三个是否都是yes,如果缺了就使用下面的命令:
# NTP enabled: yes
timedatectl set-ntp on
# NTP synchronized: yes
# 将当前时间和日期写入BIOS,避免重启后失效
hwclock -w
# RTC in local TZ: yes
timedatectl set-local-rtc 1